����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.143.247.214 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/app6/application/salesHonorarios/ |
Upload File : |
<?php session_start(); $sale1= $_POST['id_sales']; //$sale1 = 'J211031014'; //echo $_POST['TypeClient']; if(isset($sale1)) { require_once ("../model/dbconn.php"); require_once ("../model/pos.php"); $posConfig = new pos(); //impuesto general $impuestoBD = $posConfig->getByPreffix('imp-val')[1]['val']; //usuario multifacturas real $userMulti = $posConfig->getByPreffix('Usuario_Factura')[1]['val']; //pass multifacturas real $passMulti = $posConfig->getByPreffix('pass_fac')[1]['val']; //detalles $ArchCerDemo = $posConfig->getByPreffix('archivo_cer_demo')[1]['val']; $ArchKeyDemo = $posConfig->getByPreffix('archivo_key_demo')[1]['val']; $settingsEmisor = $posConfig->getByPreffix('name_val')[1]['val']; $settingsCP = $posConfig->getByPreffix('cp_val')[1]['val']; $RegimenDemo = $posConfig->getByPreffix('Regimen_sat')[1]['val']; $settingsCodigoSat = $posConfig->getByPreffix('Sat_val')[1]['val']; $settingsUnidadSat = $posConfig->getByPreffix('Sat_val_Unidad')[1]['val']; $RFC_demo_Emisor = $posConfig->getByPreffix('rfc_val')[1]['val']; $RFC_nombre_Emisor = $posConfig->getByPreffix('name_val')[1]['val']; $PassDemoMulti= $posConfig->getByPreffix('Pass_Sat_demo')[1]['val']; $logo = $posConfig->getByPreffix('report_image')[1]['val']; $emailPrincipal = $posConfig->getByPreffix('admin_email')[1]['val']; //facturacion real SI(real)/NO(demo) $FacturacionReal = $posConfig->getByPreffix('demo_fac')[1]['val']; //DATOS POST $client_name= $_POST['client_name']; $client_rfc= $_POST['rfc']; $uso_cfdi= $_POST['uso_cfdi']; $FormaPago = $_POST['FormaPago']; $posForma= new pos(); $FormaPago = $posForma->getFormakId($FormaPago)[1]['def']; /* $client_name= 'ISRAEL ALVARADO AGUILAR'; $client_rfc='AAAI800508K2A'; $uso_cfdi= 'G01'; $FormaPago = '01'; */ //obtenemos sell_id $posSell=new pos(); $sell = $posSell->getlistSell($sale1); $sell_id = $posSell->getlistSell($sale1)[1]['id']; // Se desactivan los mensajes de debug error_reporting(~(E_WARNING|E_NOTICE)); //error_reporting(E_ALL); // Se especifica la zona horaria date_default_timezone_set('America/Mexico_City'); //libreria qr include_once "../../../../sdk/lib/modulos/qr/qr.php"; // Se incluye el SDK require_once '../../../../sdk/sdk2.php'; // Se especifica la version de CFDi 3.3 $datos['version_cfdi'] = '3.3'; // Ruta del XML Timbrado $datos['cfdi']='../../../../sdk/timbrados/cfdi_factura_'.$sale1.'.xml'; // Ruta del XML de Debug $datos['xml_debug']='../../../../sdk/timbrados/sin_timbrar_factura_'.$sale1.'.xml'; // Credenciales de Timbrado $datos['PAC']['usuario'] = ''.$userMulti.''; $datos['PAC']['pass'] = ''.$passMulti.''; $datos['PAC']['produccion'] = ''.$FacturacionReal.''; // Rutas y clave de los CSD $datos['conf']['cer'] = '../../../../sdk/certificados/'.$ArchCerDemo.''; $datos['conf']['key'] = '../../../../sdk/certificados/'.$ArchKeyDemo.''; $datos['conf']['pass'] = ''.$PassDemoMulti.''; $operations=new pos(); $operation1 = $operations->getOperations($sale1); $i=0; $impuesto=0; $subtotal=0; //OPCIONAL, UTILIZAR LA LIBRERIA PHP DE OPENSSL, DEFAULT SI $datos['php_openssl']='SI'; $datos['factura']['serie'] = 'H'; //opcional $datos['factura']['folio'] = $sell_id; //opcional $datos['factura']['fecha_expedicion'] = date('Y-m-d\TH:i:s',time()-120);// Opcional "time()-120" para retrasar la hora 2 minutos para evitar falla de error en rango de fecha $datos['factura']['metodo_pago'] = 'PUE'; // VER DOCUMENTACION :: EFECTIV0, CHEQUE, TARJETA DE CREDITO, TRANSFERENCIA BANCARIA, NO IDENTIFICADO $datos['factura']['forma_pago'] = $FormaPago; //PAGO EN UNA SOLA EXHIBICION, CREDITO 7 DIAS, CREDITO 15 DIAS, CREDITO 30 DIAS, ETC $datos['factura']['tipocomprobante'] = 'I'; $datos['factura']['moneda'] = 'MXN'; // MXN USD EUR $datos['factura']['tipocambio'] = 1; // OPCIONAL (MXN = 1.00, OTRAS EJ: USD = 13.45; EUR = 16.86) $datos['factura']['LugarExpedicion'] = $settingsCP; //$datos['factura']['NumCtaPago'] = '0234'; //opcional; 4 DIGITOS pero obligatorio en transferencias y cheques $datos['factura']['RegimenFiscal'] = ''.$RegimenDemo.''; //datos de Emisor $datos['emisor']['rfc'] = ''.$RFC_demo_Emisor.''; //RFC DE PRUEBA $datos['emisor']['nombre'] = "".$settingsEmisor.""; // EMPRESA DE PRUEBA // IMPORTANTE PROBAR CON NOMBRE Y RFC REAL O GENERARA ERROR DE XML MAL FORMADO // Datos del Receptor $datos['receptor']['UsoCFDI'] = $uso_cfdi; $datos['receptor']['rfc'] = $client_rfc; $datos['receptor']['nombre'] = $client_name; //AGREGAR 10 CONCEPTOS DE PRUEBA foreach($operation1 as $operation){ $price_sin = number_format($operation['price'],2); $price_sin = floatval(preg_replace('/[^\d.]/', '', $price_sin)); $concepto['ClaveProdServ'] = '84111506'; $concepto['cantidad'] = $operation['qty']; $concepto['unidad'] = 'NO APLICA'; $concepto['ClaveUnidad'] = "ACT"; //ID, REF, CODIGO O SKU DEL PRODUCTO $concepto['descripcion'] = $operation['item_name']; $concepto['valorunitario'] = $price_sin; // SIN IVA $concepto['importe'] = $price_sin; } $datos['conceptos'][0] = $concepto; $iva_tras =0.00; $datos['conceptos'][0]['Impuestos']['Traslados'][0]['Base'] = $price_sin; $datos['conceptos'][0]['Impuestos']['Traslados'][0]['Impuesto'] = '002'; $datos['conceptos'][0]['Impuestos']['Traslados'][0]['TasaOCuota'] = '0.000000'; $datos['conceptos'][0]['Impuestos']['Traslados'][0]['Importe'] = $iva_tras; $datos['conceptos'][0]['Impuestos']['Traslados'][0]['TipoFactor'] = 'Tasa'; $iva_ret = 0.00; $datos['conceptos'][0]['Impuestos']['Retenciones'][0]['Impuesto'] = '002'; $datos['conceptos'][0]['Impuestos']['Retenciones'][0]['Importe'] = $iva_ret; // iva de los productos facturados $datos['conceptos'][0]['Impuestos']['Retenciones'][0]['Base'] = $price_sin; $datos['conceptos'][0]['Impuestos']['Retenciones'][0]['TasaOCuota'] = '0.000000'; $datos['conceptos'][0]['Impuestos']['Retenciones'][0]['TipoFactor'] = 'Tasa'; if($_POST['TypeClient']== 2){ $ISR = 0.00; $impuestos = 0; }else{ $ISR = $price_sin * 0.10; $datos['conceptos'][0]['Impuestos']['Retenciones'][1]['Impuesto'] = '001'; $datos['conceptos'][0]['Impuestos']['Retenciones'][1]['Importe'] = $ISR; // iva de los productos facturados $datos['conceptos'][0]['Impuestos']['Retenciones'][1]['Base'] = $price_sin; $datos['conceptos'][0]['Impuestos']['Retenciones'][1]['TasaOCuota'] = '0.100000'; $datos['conceptos'][0]['Impuestos']['Retenciones'][1]['TipoFactor'] = 'Tasa'; $retenido2['impuesto'] = '001'; $retenido2['importe'] = $ISR; // iva de los productos facturados $datos['impuestos']['retenciones'][1] = $retenido2; $impuestos = $ISR; } $datos['impuestos']['TotalImpuestosTrasladados']= $iva_tras; $datos['impuestos']['TotalImpuestosRetenidos']=$iva_ret + $ISR; $translado1['Impuesto'] = '002'; $translado1['TasaOCuota'] = '0.000000'; $translado1['Importe'] = $iva_tras; // iva de los productos facturados $translado1['TipoFactor'] = 'Tasa'; $datos['impuestos']['translados'][0] = $translado1; $retenido['impuesto'] = '002'; $retenido['importe'] = $iva_ret; // iva de los productos facturados $datos['impuestos']['retenciones'][0] = $retenido; $total =$price_sin - $ISR; $subtotal = $price_sin; $datos['factura']['subtotal'] = $subtotal; // sin impuestos $datos['factura']['total'] = $total; // total incluyendo impuestos echo "<pre>"; print_r($datos); echo "</pre>"; // Se ejecuta el SDK $res = mf_genera_cfdi($datos); $codigo= $res['codigo_mf_numero']; $name_codigo= $res['codigo_mf_texto']; $uuid= $res['uuid']; foreach ($res AS $variable => $valor) { $valor = htmlentities($valor); $valor = str_replace('<br/>', '<br/>', $valor); echo "<b>[$variable]=</b>$valor<hr>"; } //generar el pdf $datosHTML['RESPUESTA_UTF8'] = "SI"; $datosHTML['PAC']['usuario'] = ''.$userMulti.''; $datosHTML['PAC']['pass'] = ''.$passMulti.''; $datosHTML['PAC']['produccion'] = "".$FacturacionReal.""; //MODULO MULTIFACTURAS : CONVIERTE UN XML CFDI A HTML $datosHTML['modulo']="cfdi2html"; //NOMBRE MODULO $datosHTML['rutaxml']=$datos['cfdi']; //RUTA DEL XML CFDI $MombreEmisor= $settingsEmisor->val; $datosHTML['titulo']=''.$MombreEmisor.''; //TITULO DE FACTURA $datosHTML['tipo']="FACTURA"; //TIPO DE FACTURA VENTA,NOMINA,ARRENDAMIENTO, $datosHTML['path_logo']="../../../../sdk/timbrados/logo.png"; //RUTA DE LOGOTIPO DE FACTURA $datosHTML['notas']="Pago en una sola exhibicion"; //NOTA IMPRESA EN FACTURA $datosHTML['color_marco']="#324273"; //COLOR DEL MARCO DE LA FACTURA $datosHTML['color_marco_texto']="#24B7C8"; //COLOR DEL TEXTO DEL MARCO DE LA FACTURA $datosHTML['color_texto']="#042125"; //COLOR DEL TEXTO EN GENERAL $datosHTML['fuente_texto']="monospace"; //FUENTE DEL TEXTO EN GENERAL $res = mf_ejecuta_modulo($datosHTML); //FUNCION QUE CARGA EL MODULO cfdi2html $HTML=$res['html']; //HTML DEL XML //RESPUESTA DE LA FUNCION CARGAR MODULO ////////////////////////////////////////////////////////////////////////////// //CONVERTIR EL HTML DEL XML CFDI A PDF $datosPDF['PAC']['usuario'] = ''.$userMulti.''; $datosPDF['PAC']['pass'] = ''.$passMulti.''; $datosPDF['PAC']['produccion'] = "".$FacturacionReal.""; $datosPDF['modulo']="html2pdf"; //NOMBRE MODULO $datosPDF['html']="$HTML"; // HTML DE XML CFDI A CONVERTIR A PDF $datosPDF['archivo_html']=""; // OPCION SI SE TIENE UN ARCHIVO .HTML $datosPDF['archivo_pdf']="../../../../sdk/timbrados/cfdi_factura_".$sale1.".pdf"; //$datosPDF['archivo_pdf']="RUTA DONDE SE CREARA EL PDF/nombrearhivo.pdf"; //RUTA DONDE SE GUARDARA EL PDF $res = mf_ejecuta_modulo($datosPDF); if($codigo == 0){ $id=$sell_id; $mail=$emailPrincipal; $uuid=$uuid; $rfc=$client_rfc; $sell_id=$id; $sale_id=$sale1; $total=$total; $iva=$impuestoBD; $name=$client_name; $user_id = $_SESSION['pos_id']; $pos = new pos(); $insert = $pos->saveFacturaHono($mail,$uuid,$rfc,$sell_id,$sale_id , $subtotal, $impuestos ,$total,$iva,$name,$user_id); $retval['result'] = $insert[0]; $retval['error'] = $insert[1]; $retval['xsale_id'] = $insert[2]; if($retval['result'] == 1){ print "<script>window.location='./basica11.php?uuid=$uuid&id=$sell_id&rfc=$client_rfc&name=$client_name&sale1=$sale_id';</script>"; }else{ echo "Error al guardar Registro en Base de Datos, Reporte a Sistemas, para registro , y obtener XML,PDF"; } }else{ echo "<h1>Respuesta Generar XML y Timbrado</h1>"; foreach ($res AS $variable => $valor) { $valor = htmlentities($valor); $valor = str_replace('<br/>', '<br/>', $valor); echo "<b>[$variable]=</b>$valor<hr>"; } //print "<script>window.location='http://localhost/pos36/pos11/?view=errFact&uuid=$codigo&name_codigo=$name_codigo&id=$id';</script>"; } } ?>