Viewing file: recibo.php (37.56 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class recibo extends CI_Controller { function __construct() { parent::__construct(); $this->load->model('consultas_model'); /* Cargamos la base de datos */ $this->load->database(); $this->load->library('javascript'); $this->load->library('session');
/* Añadimos el helper al controlador */ $this->load->helper('url'); } public function index() { $buscador = $this->input->post('buscando'); $this->session->set_userdata('buscando', $buscador); $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $config['base_url'] = base_url().'/recibo/index'; //establecemos la URL para las paginas $config['total_rows'] =$this->consultas_model->consulta_Cantidad_clientes(); //llamo a una funcion del modelo que me retorna la cantidad de usuarios que tengo en la tabla usuario. $config['full_tag_open'] = '<div class="pagination"><ul>'; $config['full_tag_close'] = '</ul></div><!--pagination-->'; $config['first_link'] = '« First'; $config['first_tag_open'] = '<li class="prev page">'; $config['first_tag_close'] = '</li>'; $config['last_link'] = 'Ultimo »'; $config['last_tag_open'] = '<li class="next page">'; $config['last_tag_close'] = '</li>'; $config['next_link'] = 'Siguiente →'; $config['next_tag_open'] = '<li class="next page">'; $config['next_tag_close'] = '</li>'; $config['prev_link'] = '← Anterior'; $config['prev_tag_open'] = '<li class="prev page">'; $config['prev_tag_close'] = '</li>'; $config['cur_tag_open'] = '<li class="active"><a href="">'; $config['cur_tag_close'] = '</a></li>'; $config['num_tag_open'] = '<li class="page">'; $config['num_tag_close'] = '</li>'; $config['per_page'] = '10'; $config["uri_segment"] = 3;//el segmento de la paginación
$this->pagination->initialize($config); $datos_recibo = array( 'nuevoRecibo' => 'true', 'vieneAfuera'=>'true' ); $this->session->set_userdata($datos_recibo); $data = array( "contenido" =>"recibo_view", "titulo" =>"Crear Recibo para Facturas tipo A", "results" =>$this->consultas_model->consulta_clientesA($buscador,$config['per_page'],$this->uri->segment(3)), ); $this->load->view('template',$data); } public function indexB() { $buscador = $this->input->post('buscando'); $this->session->set_userdata('buscando', $buscador); $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $config['base_url'] = base_url().'/recibo/indexB'; //establecemos la URL para las paginas $config['total_rows'] =$this->consultas_model->consulta_Cantidad_clientes(); //llamo a una funcion del modelo que me retorna la cantidad de usuarios que tengo en la tabla usuario. $config['per_page'] = '10'; $config['first_link'] = 'Primera';//primer link $config['last_link'] = 'Ultima';//último link $config["uri_segment"] = 3;//el segmento de la paginación $config['next_link'] = 'Siguiente';//siguiente link $config['prev_link'] = 'Anterior';//anterior link $this->pagination->initialize($config); $datos_recibo = array( 'nuevoRecibo' => 'true', 'vieneAfuera'=>'true' ); $this->session->set_userdata($datos_recibo); $data = array( "contenido" =>"reciboB_view", "titulo" =>"Crear Recibo para Facturas tipo B", "results" =>$this->consultas_model->consulta_clientesB($buscador,$config['per_page'],$this->uri->segment(3)), ); $this->load->view('template',$data); }
public function indexN() { $buscador = $this->input->post('buscando'); $this->session->set_userdata('buscando', $buscador); $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $config['base_url'] = base_url().'/recibo/indexB'; //establecemos la URL para las paginas $config['total_rows'] =$this->consultas_model->consulta_Cantidad_clientes(); //llamo a una funcion del modelo que me retorna la cantidad de usuarios que tengo en la tabla usuario. $config['per_page'] = '10'; $config['first_link'] = 'Primera';//primer link $config['last_link'] = 'Ultima';//último link $config["uri_segment"] = 3;//el segmento de la paginación $config['next_link'] = 'Siguiente';//siguiente link $config['prev_link'] = 'Anterior';//anterior link $this->pagination->initialize($config); $datos_recibo = array( 'nuevoRecibo' => 'true', 'vieneAfuera'=>'true' ); $this->session->set_userdata($datos_recibo); $data = array( "contenido" =>"reciboN_view", "titulo" =>"Crear Recibo para Remitos", "results" =>$this->consultas_model->consulta_clientes($buscador,$config['per_page'],$this->uri->segment(3)), ); $this->load->view('template',$data); } public function consultaTotalRemito() { $facturas=$_POST["facturas"]; $total=$this->consultas_model->getTotalByIdRemito($facturas); echo $total[0]->total; } public function consultaTotal() { $facturas=$_POST["facturas"]; $total=$this->consultas_model->getTotalByIdFactura($facturas); echo $total[0]->total; } public function listarRetenciones(){ $anioActual=date("Y"); $mes=""; $filtroRetencion = $this->input->post('comboRetencion'); $filtroPeriodo = $this->input->post('comboPeriodo'); $buscadorRetencion=null; $fechaInicial=null; $fechaFinal=null; if($filtroPeriodo !=null){ switch ($filtroPeriodo) { case 'ENERO':
$mes= '01'; break; case 'FEBRERO': $mes= '02'; break; case 'MARZO': $mes= '03'; break; case 'ABRIL': $mes= '04'; break; case 'MAYO': $mes= '05'; break; case 'JUNIO': $mes= '06'; break; case 'JULIO': $mes= '07'; break; case 'AGOSTO': $mes= '08'; break; case 'SEPTIEMBRE': $mes= '09'; break; case 'OCTUBRE': $mes= '10'; break; case 'NOVIEMBRE': $mes= '11'; break; case 'DICIEMBRE': $mes= '12'; break; } $fechaInicial=$anioActual."-".$mes."-"."01"; $fechaFinal = strtotime ( '+1 month' , strtotime ( $fechaInicial ) ) ; $fechaFinal = strtotime ( '-1 day' , $fechaFinal ) ; $fechaFinal = date ( 'Y-m-d' , $fechaFinal ); $fechaInicial .= " 00:00:00"; $fechaFinal .=" 00:00:00";
}
if($filtroRetencion !=null){ $filtroRet=$this->consultas_model->getTipoRetByName($filtroRetencion); if($filtroRet != null){ $buscadorRetencion=$filtroRet[0]->id; } }
$this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $config['base_url'] = base_url().'/recibo/listarRetenciones/'; //establecemos la URL para las paginas //$config['total_rows'] =$this->consultas_model->consulta_Cantidad_Retenciones('',$buscador); //llamo a una funcion del modelo que me retorna la cantidad de usuarios que tengo en la tabla usuario. $config['per_page'] = '10'; $config['first_link'] = 'Primera';//primer link $config['last_link'] = 'Ultima';//último link $config["uri_segment"] = 3;//el segmento de la paginación $config['next_link'] = 'Siguiente';//siguiente link $config['prev_link'] = 'Anterior';//anterior link $this->pagination->initialize($config);
$totalResultado=$this->consultas_model->getTotalRetenciones($buscadorRetencion,$fechaInicial,$fechaFinal);
$data = array( "contenido" =>"retenc_view", "titulo" =>"Retenciones Registradas", "total"=>$totalResultado[0]->valor, "filtroTipo" =>$filtroRetencion, "results" =>$this->consultas_model->getRetenciones($buscadorRetencion,$fechaInicial,$fechaFinal), ); $this->load->view('template',$data); } public function listarTrasnferencias(){ $buscador = $this->input->post('buscando'); $this->session->set_userdata('buscando', $buscador); $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $config['base_url'] = base_url().'/recibo/listarTrasnferencias/'; //establecemos la URL para las paginas $config['total_rows'] =$this->consultas_model->consulta_Cantidad_Transferencias(); //llamo a una funcion del modelo que me retorna la cantidad de usuarios que tengo en la tabla usuario. $config['per_page'] = '10'; $config['first_link'] = 'Primera';//primer link $config['last_link'] = 'Ultima';//último link $config["uri_segment"] = 3;//el segmento de la paginación $config['next_link'] = 'Siguiente';//siguiente link $config['prev_link'] = 'Anterior';//anterior link $this->pagination->initialize($config);
$data = array( "contenido" =>"trasnf_view", "titulo" =>"Transferencias Registradas", "results" =>$this->consultas_model->getTransferencias($buscador,$config['per_page'],$this->uri->segment(3)), ); $this->load->view('template',$data); } public function listarCheques(){ $buscador = $this->input->post('buscando'); $this->session->set_userdata('buscando', $buscador); $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $config['base_url'] = base_url().'/recibo/listarCheques/'; //establecemos la URL para las paginas $config['total_rows'] =$this->consultas_model->consulta_Cantidad_Cheques(); //llamo a una funcion del modelo que me retorna la cantidad de usuarios que tengo en la tabla usuario. $config['per_page'] = '10'; $config['first_link'] = 'Primera';//primer link $config['last_link'] = 'Ultima';//último link $config["uri_segment"] = 3;//el segmento de la paginación $config['next_link'] = 'Siguiente';//siguiente link $config['prev_link'] = 'Anterior';//anterior link $this->pagination->initialize($config); $data = array( "contenido" =>"cheques_view", "titulo" =>"Cheques Registrados", "results" =>$this->consultas_model->getCheques($buscador,$config['per_page'],$this->uri->segment(3)), ); $this->load->view('template',$data); } public function eliminarChequeSi(){ $nroCheque=$_POST["nroCheque"]; $respuesta=$this->consultas_model->eliminarCheque($nroCheque); echo $respuesta; } public function ingresarCheque(){ $cliente=$_POST["cliente"]; $recibo=$_POST["nroRecibo"]; $nroCheque=$_POST["nroCheque"]; $titular=$_POST["titular"]; $fechaVenc=$_POST["fechaVenc"]; $banco=$_POST["banco"]; $monto=$_POST["monto"]; $tipoRetencion=$_POST["retencionTipo"]; $retencion=$_POST["retencion"]; $tipoRet=$this->consultas_model->getTipoRetByName($tipoRetencion); if($retencion !=null){ $this->consultas_model->registrarRetencion($retencion,$cliente,$recibo,$tipoRet[0]->id); } $respuesta=$this->consultas_model->registrarCheque($nroCheque,$cliente,'1',$titular,$fechaVenc,$banco,$monto); } public function hacerRecibo() { $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $datosCliente=array(); $nroFactura=null; $nuevoRecibo=""; $nuevoRecibo = $this->session->userdata('nuevoRecibo');
if(isset($_POST["numeroClienteRecibo"])){ $datosCliente=$this->consultas_model->consulta_clientesById($_POST["numeroClienteRecibo"]); $nroRecibo=$this->consultas_model->getNextRecibo(); if(strcmp($nuevoRecibo, 'true')== 0){ //crear recibo nuevo $this->consultas_model->crearRecibo($nroRecibo[0]->cant,$_POST["numeroClienteRecibo"]); } } $datos_Recibo = array( 'nuevoRecibo' => 'false' ); $data = array( "datos"=>$datosCliente[0], "contenido" =>"recibo_generacion_view", "nroRecibo" =>$nroRecibo[0]->cant, "titulo" =>"Generacion de Recibo" ); $this->load->view('template',$data); } public function hacerReciboB() { $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $datosCliente=array(); $nroFactura=null; $nuevoRecibo=""; $nuevoRecibo = $this->session->userdata('nuevoRecibo'); if(isset($_POST["numeroClienteRecibo"])){ $datosCliente=$this->consultas_model->consulta_clientesById($_POST["numeroClienteRecibo"]); $nroRecibo=$this->consultas_model->getNextRecibo(); if(strcmp($nuevoRecibo, 'true')== 0){ //crear recibo nuevo $this->consultas_model->crearRecibo($nroRecibo[0]->cant,$_POST["numeroClienteRecibo"]); } } $datos_Recibo = array( 'nuevoRecibo' => 'false' ); $data = array( "datos"=>$datosCliente[0], "contenido" =>"recibo_generacion_view", "nroRecibo" =>$nroRecibo[0]->cant, "titulo" =>"Generacion de Recibo" ); $this->load->view('template',$data); } public function hacerReciboN() { $this->load->library('pagination'); //cargamos la libreria de paginacion $this->load->library('table'); $datosCliente=array(); $nroFactura=null; $nuevoRecibo=""; $nuevoRecibo = $this->session->userdata('nuevoRecibo'); if(isset($_POST["numeroClienteRecibo"])){ $datosCliente=$this->consultas_model->consulta_clientesById($_POST["numeroClienteRecibo"]); $nroRecibo=$this->consultas_model->getNextRecibo(); if(strcmp($nuevoRecibo, 'true')== 0){ //crear recibo nuevo $this->consultas_model->crearRecibo($nroRecibo[0]->cant,$_POST["numeroClienteRecibo"]); } } $datos_Recibo = array( 'nuevoRecibo' => 'false' ); $data = array( "datos"=>$datosCliente[0], "contenido" =>"reciboN_generacion_view", "nroRecibo" =>$nroRecibo[0]->cant, "titulo" =>"Generacion de Recibo" ); $this->load->view('template',$data); }
function subfijo($xx) { // esta función regresa un subfijo para la cifra $xx = trim($xx); $xstrlen = strlen($xx); if ($xstrlen == 1 || $xstrlen == 2 || $xstrlen == 3) $xsub = ""; // if ($xstrlen == 4 || $xstrlen == 5 || $xstrlen == 6) $xsub = "MIL"; // return $xsub; } function numtoletras($xcifra) { $xarray = array(0 => "Cero", 1 => "UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE", "DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECISEIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE", "VEINTI", 30 => "TREINTA", 40 => "CUARENTA", 50 => "CINCUENTA", 60 => "SESENTA", 70 => "SETENTA", 80 => "OCHENTA", 90 => "NOVENTA", 100 => "CIENTO", 200 => "DOSCIENTOS", 300 => "TRESCIENTOS", 400 => "CUATROCIENTOS", 500 => "QUINIENTOS", 600 => "SEISCIENTOS", 700 => "SETECIENTOS", 800 => "OCHOCIENTOS", 900 => "NOVECIENTOS" ); // $xcifra = trim($xcifra); $xlength = strlen($xcifra); $xpos_punto = strpos($xcifra, "."); $xaux_int = $xcifra; $xdecimales = "00"; if (!($xpos_punto === false)) { if ($xpos_punto == 0) { $xcifra = "0" . $xcifra; $xpos_punto = strpos($xcifra, "."); } $xaux_int = substr($xcifra, 0, $xpos_punto); // obtengo el entero de la cifra a covertir $xdecimales = substr($xcifra . "00", $xpos_punto + 1, 2); // obtengo los valores decimales } $XAUX = str_pad($xaux_int, 18, " ", STR_PAD_LEFT); // ajusto la longitud de la cifra, para que sea divisible por centenas de miles (grupos de 6) $xcadena = ""; for ($xz = 0; $xz < 3; $xz++) { $xaux = substr($XAUX, $xz * 6, 6); $xi = 0; $xlimite = 6; // inicializo el contador de centenas xi y establezco el límite a 6 dígitos en la parte entera $xexit = true; // bandera para controlar el ciclo del While while ($xexit) { if ($xi == $xlimite) { // si ya llegó al límite máximo de enteros break; // termina el ciclo } $x3digitos = ($xlimite - $xi) * -1; // comienzo con los tres primeros digitos de la cifra, comenzando por la izquierda $xaux = substr($xaux, $x3digitos, abs($x3digitos)); // obtengo la centena (los tres dígitos) for ($xy = 1; $xy < 4; $xy++) { // ciclo para revisar centenas, decenas y unidades, en ese orden switch ($xy) { case 1: // checa las centenas if (substr($xaux, 0, 3) < 100) { // si el grupo de tres dígitos es menor a una centena ( < 99) no hace nada y pasa a revisar las decenas } else { $key = (int) substr($xaux, 0, 3); if (TRUE === array_key_exists($key, $xarray)){ // busco si la centena es número redondo (100, 200, 300, 400, etc..) $xseek = $xarray[$key]; $xsub = $this->subfijo($xaux); // devuelve el subfijo correspondiente (Millón, Millones, Mil o nada) if (substr($xaux, 0, 3) == 100) $xcadena = " " . $xcadena . " CIEN " . $xsub; else $xcadena = " " . $xcadena . " " . $xseek . " " . $xsub; $xy = 3; // la centena fue redonda, entonces termino el ciclo del for y ya no reviso decenas ni unidades } else { // entra aquí si la centena no fue numero redondo (101, 253, 120, 980, etc.) $key = (int) substr($xaux, 0, 1) * 100; $xseek = $xarray[$key]; // toma el primer caracter de la centena y lo multiplica por cien y lo busca en el arreglo (para que busque 100,200,300, etc) $xcadena = " " . $xcadena . " " . $xseek; } // ENDIF ($xseek) } // ENDIF (substr($xaux, 0, 3) < 100) break; case 2: // checa las decenas (con la misma lógica que las centenas) if (substr($xaux, 1, 2) < 10) { } else { $key = (int) substr($xaux, 1, 2); if (TRUE === array_key_exists($key, $xarray)) { $xseek = $xarray[$key]; $xsub = $this->subfijo($xaux); if (substr($xaux, 1, 2) == 20) $xcadena = " " . $xcadena . " VEINTE " . $xsub; else $xcadena = " " . $xcadena . " " . $xseek . " " . $xsub; $xy = 3; } else { $key = (int) substr($xaux, 1, 1) * 10; $xseek = $xarray[$key]; if (20 == substr($xaux, 1, 1) * 10) $xcadena = " " . $xcadena . " " . $xseek; else $xcadena = " " . $xcadena . " " . $xseek . " Y "; } // ENDIF ($xseek) } // ENDIF (substr($xaux, 1, 2) < 10) break; case 3: // checa las unidades if (substr($xaux, 2, 1) < 1) { // si la unidad es cero, ya no hace nada } else { $key = (int) substr($xaux, 2, 1); $xseek = $xarray[$key]; // obtengo directamente el valor de la unidad (del uno al nueve) $xsub = $this->subfijo($xaux); $xcadena = " " . $xcadena . " " . $xseek . " " . $xsub; } // ENDIF (substr($xaux, 2, 1) < 1) break; } // END SWITCH } // END FOR $xi = $xi + 3; } // ENDDO if (substr(trim($xcadena), -5, 5) == "ILLON") // si la cadena obtenida termina en MILLON o BILLON, entonces le agrega al final la conjuncion DE $xcadena.= " DE"; if (substr(trim($xcadena), -7, 7) == "ILLONES") // si la cadena obtenida en MILLONES o BILLONES, entoncea le agrega al final la conjuncion DE $xcadena.= " DE"; // ----------- esta línea la puedes cambiar de acuerdo a tus necesidades o a tu país ------- if (trim($xaux) != "") { switch ($xz) { case 0: if (trim(substr($XAUX, $xz * 6, 6)) == "1") $xcadena.= "UN BILLON "; else $xcadena.= " BILLONES "; break; case 1: if (trim(substr($XAUX, $xz * 6, 6)) == "1") $xcadena.= "UN MILLON "; else $xcadena.= " MILLONES "; break; case 2: if ($xcifra < 1) { $xcadena = "CERO PESOS $xdecimales/100"; } if ($xcifra >= 1 && $xcifra < 2) { $xcadena = "UN PESO $xdecimales/100 "; } if ($xcifra >= 2) { $xcadena.= " PESOS $xdecimales/100 "; // } break; } // endswitch ($xz) } // ENDIF (trim($xaux) != "") // ------------------ en este caso, para México se usa esta leyenda ---------------- $xcadena = str_replace("VEINTI ", "VEINTI", $xcadena); // quito el espacio para el VEINTI, para que quede: VEINTICUATRO, VEINTIUN, VEINTIDOS, etc $xcadena = str_replace(" ", " ", $xcadena); // quito espacios dobles $xcadena = str_replace("UN UN", "UN", $xcadena); // quito la duplicidad $xcadena = str_replace(" ", " ", $xcadena); // quito espacios dobles $xcadena = str_replace("BILLON DE MILLONES", "BILLON DE", $xcadena); // corrigo la leyenda $xcadena = str_replace("BILLONES DE MILLONES", "BILLONES DE", $xcadena); // corrigo la leyenda $xcadena = str_replace("DE UN", "UN", $xcadena); // corrigo la leyenda } // ENDFOR ($xz) return trim($xcadena); }
public function reciboTransferencia(){ $direccion= $this->session->userdata('dire'); $this->load->library('pdf'); $facturas= Array(); ob_start(); $codTransf=$_GET["codTransf"]; $monto=$_GET["monto"]; $cliente=$_GET["cliente"]; $nroRecibo=$_GET["nroRecibo"]; $retencion= $_GET["retencion"]; $retencionTipo= $_GET["tipoRetencion"]; $iva=""; $operacion='2';
$tipoRet=$this->consultas_model->getTipoRetByName($retencionTipo); //registrar transaccion if($retencion !=null){ $this->consultas_model->registrarRetencion($retencion,$cliente,$nroRecibo,$tipoRet[0]->id); } //registrar transaccion $saldoAnterior=$this->consultas_model->getSaldo($cliente); $descripcion="Cancelacion Facturas: ";
$this->consultas_model->registrarTransferencia($codTransf,$monto,$cliente,$nroRecibo); $montoAcumulado=0; $cantidadCancelaFactura=0; $listadoFacturas=$_GET["facturas"]; if($listadoFacturas != null){ $facturas=unserialize(stripslashes($listadoFacturas)); } $listadoRemitos=$_GET["remitos"]; if($listadoRemitos != null){ $remitos=unserialize(stripslashes($listadoRemitos)); } if($facturas !=null){ $descripcion="Cancelacion Factura: "; foreach($facturas as $fact){ $descripcion .=$fact. " - "; $totalFactura=$this->consultas_model->getTotalByIdFactura($fact); $montoAcumulado=$this->consultas_model->getFraAcumulado($fact); $cantidadCancelaFactura=round($monto+$montoAcumulado[0]->monto_acumulado,2); if($cantidadCancelaFactura >= $totalFactura){ $this->consultas_model->registrarPagoParcial($fact,$cantidadCancelaFactura); $this->consultas_model->cambiarEstadoFactura($fact,2); } else{ $this->consultas_model->registrarPagoParcial($fact,$cantidadCancelaFactura); } } } if($remitos !=null){ $descripcion="Cancelacion Remito: "; foreach($remitos as $rem){ $descripcion .=$rem. " - "; $totalRemito=$this->consultas_model->getTotalByIdRemito($rem); $montoAcumulado=$this->consultas_model->getRemAcumulado($rem); $cantidadCancelaFactura=round($monto+$montoAcumulado[0]->monto_acumulado,2); if($cantidadCancelaFactura >= $totalRemito){ $this->consultas_model->registrarPagoParcialRemito($rem,$cantidadCancelaFactura); $this->consultas_model->cambiarEstadoRemito($fact,2); } else{ $this->consultas_model->registrarPagoParcialRemito($rem,$cantidadCancelaFactura); } } } $descripcion .=" por transferencia Bancaria nro ( ".$codTransf . " ) ";
$this->consultas_model->actualizarRecibo($nroRecibo,$cliente,$monto); $this->consultas_model->registrarDetalleRecibo($cliente,$descripcion,$monto,$nroRecibo,$saldoAnterior->valor_saldo);
//cambiar estado de la factura que se cobro //actualizar saldo $this->consultas_model->actualizarSaldo($cliente,$monto,$operacion); $montoLetras=$this->numtoletras($monto); $montoFinal="Recibi (mos) la suma de ".$montoLetras; $concepto="en concepto de Factura numero "; foreach($facturas as $fact){ $concepto .=$fact. " - "; } $concepto .= " Mediante pago bancario nro ( " . $codTransf.")"; $this->pdf = new Pdf(); // Agregamos una página $this->pdf->AddPage(); // Define el alias para el número de página que se imprimirá en el pie $this->pdf->AliasNbPages(); $datosCliente=$this->consultas_model->consulta_clientesById($cliente); $this->pdf->SetTitle("RECIBO"); $this->pdf->SetLeftMargin(15); $this->pdf->SetRightMargin(15); $this->pdf->SetFillColor(200,200,200); $fecha= date('d/m/Y H:i:s'); $fechaReal=explode(" ",$fecha); $fechaReal=$fechaReal[0]; $this->pdf->SetFont('Arial', 'B', 14); $this->pdf->Ln(5); $this->pdf->Cell(180,7,"RECIBO",0,0,'R','0'); $this->pdf->Ln(5); $this->pdf->SetFont('Arial', 'B', 9); $this->pdf->Cell(180,7,"Nº ".$nroRecibo,0,0,'R','0'); $this->pdf->Ln(5); $this->pdf->Cell(180,7,"FECHA ".$fechaReal,0,2,'R','0'); $this->pdf->Ln(5); $this->pdf->SetFont('Arial', 'B', 9); $this->pdf->Rect(5, 5, 200, 280, 'D'); $this->pdf->Line(5, 50, 205, 50); $this->pdf->Line(5, 80, 205, 80); $this->pdf->Rect(45, 78,3, 3, 'D');
$this->pdf->Cell(40,7,"Señor/es: ".$datosCliente[0]->nombre,0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"Calle: ".$datosCliente[0]->direccion,0,0,'L','0');
$this->pdf->Cell(50,7,"Localidad: ".$datosCliente[0]->localidad,0,0,'R','0'); $this->pdf->Ln(7); $this->pdf->Cell(30,7,"IVA "."Resp Insc" ,0,0,'L','0'); if(($datosCliente[0]->iva =="Responsable Inscripto") ||($datosCliente[0]->iva =="RESP. INSCRIPTO")){ $this->pdf->Cell(30,7,"X" ,0,0,'L','0'); } $this->pdf->Cell(80,7," C.U.I.T Nº ".$datosCliente[0]->cuit,0,0,'R','0'); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Cell(25,7,$montoFinal,0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Cell(25,7,$concepto,0,0,'L','0'); $this->pdf->SetXY(20,250); $this->pdf->Cell(80,7,"IMPORTE ".($monto+$retencion),0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"IVA INSC ".$iva,0,0,'L','0'); $this->pdf->Cell(50,7,"FIRMA",0,0,'C','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"TOTAL ".($monto+$retencion+$iva),0,0,'L','0'); $this->pdf->Cell(50,7,"ACLARACION",0,0,'C','0'); $this->pdf->Ln(7); $dircliente = $direccion;
$dirClienteAccion = $dircliente."\\Recibos"; if(!file_exists($dirClienteAccion)){ mkdir($dirClienteAccion, 0777); }
$dirFinal = $dirClienteAccion ."\\Recibo_".$datosCliente[0]->razon_social."_".$_GET["nroRecibo"].".pdf";
// $this->pdf->Image(DIRECCION_IMAGENES."/preImpregnados.png", 20 ,20, 50 , 38,'PNG'); // $this->pdf->Image(DIRECCION_IMAGENES."/firma.png", 145 ,235, 50 , 38,'PNG'); $this->pdf->Output($dirFinal, "F"); //vuelvo a la pagina principal de facturas $link = base_url(). "remito/ListarRemito/"; header('Location: '.$link); } public function reciboEfectivo(){ $direccion= $this->session->userdata('dire'); $this->load->library('pdf'); $facturas= Array(); $remitos= Array(); ob_start(); $monto=$_GET["monto"]; $cliente=$_GET["cliente"]; $nroRecibo=$_GET["nroRecibo"]; $retencion= $_GET["retencion"]; $retencionTipo= $_GET["tipoRetencion"]; $operacion='2'; $tipoRet=$this->consultas_model->getTipoRetByName($retencionTipo);
$iva="";
//registrar transaccion if($retencion !=null){ $this->consultas_model->registrarRetencion($retencion,$cliente,$nroRecibo,$tipoRet[0]->id); } $saldoAnterior=$this->consultas_model->getSaldo($cliente);
$montoAcumulado=0; $cantidadCancelaFactura=0; $listadoFacturas=$_GET["facturas"]; if($listadoFacturas != null){ $facturas=unserialize(stripslashes($listadoFacturas)); } $listadoRemitos=$_GET["remitos"]; if($listadoRemitos != null){ $remitos=unserialize(stripslashes($listadoRemitos)); } if($facturas !=null){ $descripcion="Cancelacion Factura: "; foreach($facturas as $fact){ $descripcion .=$fact. " - "; $totalFactura=$this->consultas_model->getTotalByIdFactura($fact); $montoAcumulado=$this->consultas_model->getFraAcumulado($fact); $cantidadCancelaFactura=round($monto+$montoAcumulado[0]->monto_acumulado,2); if($cantidadCancelaFactura >= $totalFactura){ $this->consultas_model->registrarPagoParcial($fact,$cantidadCancelaFactura); $this->consultas_model->cambiarEstadoFactura($fact,2); } else{ $this->consultas_model->registrarPagoParcial($fact,$cantidadCancelaFactura); } } } if($remitos !=null){ $descripcion="Cancelacion Remito: "; foreach($remitos as $rem){ $descripcion .=$rem. " - "; $totalRemito=$this->consultas_model->getTotalByIdRemito($rem); $montoAcumulado=$this->consultas_model->getRemAcumulado($rem); $cantidadCancelaFactura=round($monto+$montoAcumulado[0]->monto_acumulado,2); if($cantidadCancelaFactura >= $totalRemito){ $this->consultas_model->registrarPagoParcialRemito($rem,$cantidadCancelaFactura); $this->consultas_model->cambiarEstadoRemito($fact,2); } else{ $this->consultas_model->registrarPagoParcialRemito($rem,$cantidadCancelaFactura); } } } $descripcion .=" por Pago en Efectivo ";
$this->consultas_model->actualizarRecibo($nroRecibo,$cliente,$monto); $this->consultas_model->registrarDetalleRecibo($cliente,$descripcion,$monto,$nroRecibo,$saldoAnterior->valor_saldo);
//cambiar estado de la factura que se cobro //actualizar saldo $this->consultas_model->actualizarSaldo($cliente,$monto,$operacion); $montoLetras=$this->numtoletras($monto); $montoFinal="Recibi (mos) la suma de ".$montoLetras; $concepto="en concepto de Factura numero "; foreach($facturas as $fact){ $concepto .=$fact. " - "; } $concepto .= " Mediante pago en Efectivo"; $this->pdf = new Pdf(); // Agregamos una página $this->pdf->AddPage(); // Define el alias para el número de página que se imprimirá en el pie $this->pdf->AliasNbPages(); $datosCliente=$this->consultas_model->consulta_clientesById($cliente);
$fecha= date('d/m/Y H:i:s'); $fechaReal=explode(" ",$fecha); $fechaReal=$fechaReal[0]; $this->pdf->SetFont('Arial', 'B', 14); $this->pdf->Ln(5); $this->pdf->Cell(180,7,"RECIBO",0,0,'R','0'); $this->pdf->Ln(5); $this->pdf->SetFont('Arial', 'B', 9); $this->pdf->Cell(180,7,"Nº ".$nroRecibo,0,0,'R','0'); $this->pdf->Ln(5); $this->pdf->Cell(180,7,"FECHA ".$fechaReal,0,2,'R','0');
$this->pdf->Ln(7); $this->pdf->SetFont('Arial', 'B', 9); $this->pdf->Rect(5, 5, 200, 280, 'D'); $this->pdf->Line(5, 50, 205, 50); $this->pdf->Line(5, 80, 205, 80);
$this->pdf->Cell(40,7,"Señor/es: ".$datosCliente[0]->nombre,0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"Calle: ".$datosCliente[0]->direccion,0,0,'L','0');
$this->pdf->Cell(50,7,"Localidad: ".$datosCliente[0]->localidad,0,0,'R','0'); $this->pdf->Ln(7); $this->pdf->Cell(30,7,"IVA "."Resp Insc" ,0,0,'L','0'); if(($datosCliente[0]->iva =="Responsable Inscripto") ||($datosCliente[0]->iva =="RESP. INSCRIPTO")){ $this->pdf->Cell(30,7,"X" ,0,0,'L','0'); } $this->pdf->Cell(80,7," C.U.I.T Nº ".$datosCliente[0]->cuit,0,0,'R','0'); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Cell(25,7,$montoFinal,0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Cell(25,7,$concepto,0,0,'L','0'); $this->pdf->SetXY(20,250); $this->pdf->Cell(80,7,"IMPORTE ".($monto+$retencion),0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"IVA INSC ".$iva,0,0,'L','0'); $this->pdf->Cell(50,7,"FIRMA",0,0,'C','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"TOTAL ".($monto+$retencion+$iva),0,0,'L','0'); $this->pdf->Cell(50,7,"ACLARACION",0,0,'C','0'); $this->pdf->Ln(7); $dircliente = $direccion;
$dirClienteAccion = $dircliente."\\Recibos"; if(!file_exists($dirClienteAccion)){ mkdir($dirClienteAccion, 0777); }
$dirFinal = $dirClienteAccion ."\\recibo_".$datosCliente[0]->razon_social."_".$_GET["nroRecibo"].".pdf";
// $this->pdf->Image(DIRECCION_IMAGENES."/preImpregnados.png", 20 ,20, 50 , 38,'PNG'); // $this->pdf->Image(DIRECCION_IMAGENES."/firma.png", 145 ,235, 50 , 38,'PNG'); $this->pdf->Output($dirFinal, "F"); //vuelvo a la pagina principal de facturas $link = base_url(). "remito/ListarRemito/"; header('Location: '.$link); } public function reciboCheque(){ $direccion= $this->session->userdata('dire'); $this->load->library('pdf'); $facturas= Array(); $vector=Array(); ob_start(); $cliente=$_GET["cliente"]; $nroRecibo=$_GET["nroRecibo"]; $monto=0; $descripcionPago=""; $cheques=unserialize(stripslashes($_GET["cheque"])); $operacion='2'; $iva="";
$saldoAnterior=$this->consultas_model->getSaldo($cliente);
$descripcion2 ="";
$montoAcumulado=0; $cantidadCancelaFactura=0; $listadoFacturas=$_GET["facturas"]; if($listadoFacturas != null){ $facturas=unserialize(stripslashes($listadoFacturas)); } $listadoRemitos=$_GET["remitos"]; if($listadoRemitos != null){ $remitos=unserialize(stripslashes($listadoRemitos)); } if($facturas !=null){ $descripcion="Cancelacion Factura: "; foreach($facturas as $fact){ $descripcion .=$fact. " - "; $totalFactura=$this->consultas_model->getTotalByIdFactura($fact); $montoAcumulado=$this->consultas_model->getFraAcumulado($fact); $cantidadCancelaFactura=round($monto+$montoAcumulado[0]->monto_acumulado,2); if($cantidadCancelaFactura >= $totalFactura){ $this->consultas_model->registrarPagoParcial($fact,$cantidadCancelaFactura); $this->consultas_model->cambiarEstadoFactura($fact,2); } else{ $this->consultas_model->registrarPagoParcial($fact,$cantidadCancelaFactura); } } } if($remitos !=null){ $descripcion="Cancelacion Remito: "; foreach($remitos as $rem){ $descripcion .=$rem. " - "; $totalRemito=$this->consultas_model->getTotalByIdRemito($rem); $montoAcumulado=$this->consultas_model->getRemAcumulado($rem); $cantidadCancelaFactura=round($monto+$montoAcumulado[0]->monto_acumulado,2); if($cantidadCancelaFactura >= $totalRemito){ $this->consultas_model->registrarPagoParcialRemito($rem,$cantidadCancelaFactura); $this->consultas_model->cambiarEstadoRemito($fact,2); } else{ $this->consultas_model->registrarPagoParcialRemito($rem,$cantidadCancelaFactura); } } }
$descripcion .=" pago con Cheques nro:"; $descripcion2 .=" pago con Cheques nro:"; $retencion=""; foreach($cheques as $cheq){ $valor=$this->consultas_model->getMontoCheque($cheq); if($valor->retencion !=""){ $retencion="Retencion( $".$valor->retencion ." )"; } $descripcion .=$cheq .$retencion ." - "; $descripcion2 .=$cheq.$retencion ." - "; $monto = intval($monto) + intval($valor->monto)+ intval($valor->retencion); $retencion=""; } $this->consultas_model->actualizarRecibo($nroRecibo,$cliente,$monto); $this->consultas_model->registrarDetalleRecibo($cliente,$descripcion,$monto,$nroRecibo,$saldoAnterior->valor_saldo);
//actualizar saldo $this->consultas_model->actualizarSaldo($cliente,$monto,$operacion); $montoLetras=$this->numtoletras($monto); $montoFinal="Recibi (mos) la suma de ".$montoLetras; $concepto="en concepto de Factura numero "; foreach($facturas as $fact){ $concepto .=$fact. " - "; } $concepto .= " Mediante pago en Efectivo";
$montoLetras=$this->numtoletras($monto); $montoFinal="Recibi (mos) la suma de ".$montoLetras; $concepto="en concepto de cancelacion Factura numero "; $concepto .=$descripcion2; $this->pdf = new Pdf(); // Agregamos una página $this->pdf->AddPage(); // Define el alias para el número de página que se imprimirá en el pie $this->pdf->AliasNbPages(); $datosCliente=$this->consultas_model->consulta_clientesById($cliente);
$this->pdf->SetTitle("RECIBO"); $this->pdf->SetLeftMargin(15); $this->pdf->SetRightMargin(15); $this->pdf->SetFillColor(200,200,200);
$fecha= date('d/m/Y H:i:s'); $fechaReal=explode(" ",$fecha); $fechaReal=$fechaReal[0]; $this->pdf->SetFont('Arial', 'B', 14); $this->pdf->Ln(5); $this->pdf->Cell(180,7,"RECIBO",0,0,'R','0'); $this->pdf->Ln(5); $this->pdf->SetFont('Arial', 'B', 9); $this->pdf->Cell(180,7,"RECIBO Nº ".$nroRecibo,0,0,'R','0'); $this->pdf->Ln(5); $this->pdf->Cell(180,7,"FECHA ".$fechaReal,0,2,'R','0');
$this->pdf->Ln(5); $this->pdf->Rect(5, 5, 200, 280, 'D'); $this->pdf->Line(5, 50, 205, 50); $this->pdf->Line(5, 80, 205, 80); $this->pdf->Cell(40,7,"Señor/es: ".$datosCliente[0]->nombre,0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"Calle: ".$datosCliente[0]->direccion,0,0,'L','0');
$this->pdf->Cell(50,7,"Localidad: ".$datosCliente[0]->localidad,0,0,'R','0'); $this->pdf->Ln(7); $this->pdf->Cell(30,7,"IVA "."Resp Insc" ,0,0,'L','0'); if(($datosCliente[0]->iva =="Responsable Inscripto") ||($datosCliente[0]->iva =="RESP. INSCRIPTO")){ $this->pdf->Cell(30,7,"X" ,0,0,'L','0'); } $this->pdf->Cell(80,7," C.U.I.T Nº ".$datosCliente[0]->cuit,0,0,'R','0'); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Cell(25,7,$montoFinal,0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Ln(7); $this->pdf->Cell(25,7,$concepto,0,0,'L','0');
$this->pdf->SetXY(20,250); $this->pdf->Cell(80,7,"IMPORTE ".($monto+$retencion),0,0,'L','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"IVA INSC ".$iva,0,0,'L','0'); $this->pdf->Cell(50,7,"FIRMA",0,0,'C','0'); $this->pdf->Ln(7); $this->pdf->Cell(80,7,"TOTAL ".($monto+$retencion+$iva),0,0,'L','0'); $this->pdf->Cell(50,7,"ACLARACION",0,0,'C','0'); $this->pdf->Ln(7); $dircliente = $direccion;
$dirClienteAccion = $dircliente."\\Recibos"; if(!file_exists($dirClienteAccion)){ mkdir($dirClienteAccion, 0777); }
$dirFinal = $dirClienteAccion ."\\Recibo_".$datosCliente[0]->razon_social."_".$_GET["nroRecibo"].".pdf";
// $this->pdf->Image(DIRECCION_IMAGENES."/preImpregnados.png", 20 ,20, 50 , 38,'PNG'); // $this->pdf->Image(DIRECCION_IMAGENES."/firma.png", 145 ,235, 50 , 38,'PNG'); $this->pdf->Output($dirFinal, "F"); //vuelvo a la pagina principal de facturas $link = base_url(). "remito/ListarRemito/"; header('Location: '.$link); } }
|