885037] [client 136.143.176.60:32878] PHP 2. fopen() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:188 [Tue Jul 22 06:26:12.663955 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP Warning: fopen(./LogosArochi/MAR-130913.png): failed to open stream: Permission denied in /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php on line 188 [Tue Jul 22 06:26:12.663962 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP Warning: fopen(./LogosArochi/MAR-130925.png): failed to open stream: Permission denied in /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php on line 188 [Tue Jul 22 06:26:12.663981 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP Stack trace: [Tue Jul 22 06:26:12.663982 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP Warning: fwrite() expects parameter 1 to be resource, bool given in /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php on line 189 [Tue Jul 22 06:26:12.663983 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP Stack trace: [Tue Jul 22 06:26:12.663986 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP Stack trace: [Tue Jul 22 06:26:12.663986 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP 1. {main}() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:0 [Tue Jul 22 06:26:12.663989 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP 1. {main}() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:0 [Tue Jul 22 06:26:12.663990 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP 1. {main}() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:0 [Tue Jul 22 06:26:12.663992 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP 2. fopen() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:188 [Tue Jul 22 06:26:12.663993 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP 2. fopen() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:188 [Tue Jul 22 06:26:12.663995 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP 2. fwrite() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:189 [Tue Jul 22 06:26:12.663999 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP Warning: fwrite() expects parameter 1 to be resource, bool given in /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php on line 189 [Tue Jul 22 06:26:12.664000 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP Warning: fclose() expects parameter 1 to be resource, bool given in /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php on line 190 [Tue Jul 22 06:26:12.664000 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP Warning: fwrite() expects parameter 1 to be resource, bool given in /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php on line 189 [Tue Jul 22 06:26:12.664002 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP Stack trace: [Tue Jul 22 06:26:12.664004 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP Stack trace: [Tue Jul 22 06:26:12.664006 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP Stack trace: [Tue Jul 22 06:26:12.664008 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP 1. {main}() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:0 [Tue Jul 22 06:26:12.664009 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP 1. {main}() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:0 [Tue Jul 22 06:26:12.664011 2025] [php7:notice] [pid 2887211] [client 136.143.177.62:38746] PHP 1. {main}() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:0 [Tue Jul 22 06:26:12.664012 2025] [php7:notice] [pid 2885034] [client 136.143.177.61:58506] PHP 2. fwrite() /var/www/html/imagenesAptusLegal/arochi/wsImageSave_v3.php:189 [Tue Jul 22 06:26:12.664013 2025] [php7:notice] [pid 2885037] [client 136.143.176.60:32878] PHP 2. fclose() /var/www/html/imagenesAptusLegal/aroch ['required' => true, 'type' => 'string', 'message' => 'El ID de la Orden de Cobro es requerido'], 'pAppOwner' => ['required' => true, 'type' => 'string', 'message' => 'El ID del Propietario de la Aplicación es requerido'], 'pAppName' => ['required' => true, 'type' => 'string', 'message' => 'Falta el Nombre de la Aplicación'], 'pOrgaID' => ['required' => true, 'type' => 'string'], 'invoiceID' => ['required' => true, 'type' => 'string'], 'pCiaName' => ['required' => true, 'type' => 'string'], 'pCiaAddr1' => ['required' => true, 'type' => 'string'], 'pCiaAddr2' => ['required' => true, 'type' => 'string'], 'pCiaAddr3' => ['required' => true, 'type' => 'string'], 'pDatPac' => ['required' => true, 'type' => 'string'], 'pInvNumber' => ['required' => true, 'type' => 'string'], 'pCurrentDate' => ['required' => true, 'type' => 'string'], 'pOauthOrgId' => ['required' => true, 'type' => 'string'], ]; // validación de parámetros $errors = validateParameters($_REQUEST, $paramValidationRules); // si hay errores, se envían como respuesta JSON if (!empty($errors)) { header('Content-Type: application/json'); http_response_code(400); echo json_encode([ 'status' => 'error', 'message' => 'missing params', 'errors' => $errors ]); exit; } // extracción de datos de parámetros $recordId = $_REQUEST['pRecordId']; $creatorAppOwner = $_REQUEST['pAppOwner']; $creatorAppName = $_REQUEST['pAppName']; $booksOrganizationId = $_REQUEST['pOrgaID']; $booksInvoiceId = $_REQUEST['invoiceID']; $language = isset($_REQUEST['pLang']) ? $_REQUEST['pLang']: 1; $clientName = $_REQUEST['pCiaName']; $clientAddress1 = $_REQUEST['pCiaAddr1']; $clientAddress2 = $_REQUEST['pCiaAddr2']; $clientAddress3 = $_REQUEST['pCiaAddr3']; $bDatPac = $_REQUEST['pDatPac']; $booksInvoiceNumber = $_REQUEST['pInvNumber']; $currentDate = $_REQUEST['pCurrentDate']; // obtención de datos de autenticación $creatorOAuthData = OAuthV2::getToken($creatorAppName); // se valida obtención de datos de autenticación if($creatorOAuthData->status === 'error') { header('Content-Type: application/json'); http_response_code(500); echo json_encode(['status' => 'error', 'message' => 'error trying to get oauth data for current organization']); exit; } // se obtiene el token de acceso $creatorAccessToken = $creatorOAuthData->token; // obtención de datos de prebill de ate $getPrebillData = makeCurlRequest( "https://www.zohoapis.com/creator/v2.1/data/$creatorAppOwner/$creatorAppName/report/Prebills_Query/$recordId", 'GET', [ "Authorization: Zoho-oauthtoken $creatorAccessToken", ] ); // decodifica JSON $getPrebillData = json_decode($getPrebillData); // se valida respuesta de la solicitud de obtención de datos de prebill if(isset($getPrebillData->error)) { header('Content-Type: application/json'); http_response_code(500); echo json_encode(['status' => 'error', 'message' => 'error trying to get prebill data']); exit; } // extracción de datos de prebill $prebillData = $getPrebillData->data; $prebill_number = str_pad($prebillData->Prebill_Number, 6, "0", STR_PAD_LEFT); $prebill_client = $prebillData->Client->Name; $prebill_date = ($currentDate != "")? $currentDate : $prebillData->Prebill_Date; $prebill_IncDate = $prebillData->Included_to; $prebill_currency = $prebillData->Currency; $prebill_Fees = $prebillData->Fees; $prebill_Disbur = $prebillData->Disbursements; $prebill_Fixed = $prebillData->Fixed_Fees; $prebill_FFeeDis = $prebillData->F_Fees_Discount; $prebill_SubTot = $prebillData->Subtotal_Import; $prebill_ImpIva = $prebillData->VAT_Import; $prebill_Import = $prebillData->Total_Import; $prebill_PorIva = $prebillData->VAT; $prebill_Factur = $prebillData->Billable_Hours; $prebill_NoFact = $prebillData->NON_Billable_Hours; $prebill_Trabaj = $prebillData->Worked_Hours; $prebill_NumClie = $prebillData->Client_Number; $prebill_SupName = $prebillData->Supervisor_Name; $prebill_SupMail = $prebillData->Supervisor_Email; $prebill_FootOne = $prebillData->Footer_One; $prebill_FootTwo = $prebillData->Footer_Two; $prebill_RazSoci = $prebillData->Razon_Social; $prebill_Notes = strip_tags($prebillData->Notes); $prebill_TerCon = strip_tags($prebillData->Terms_Conditions); $prebill_Ajustada = $prebillData->Ajustada; $prebill_TipoMovi = $prebillData->Tipo_Movto; $prebill_FeesAlia = $prebillData->Fees_Alias; $prebill_FFeesAli = $prebillData->Fixed_Fees_Alias; $prebill_AASubTot = $prebillData->AA_Subtotal_Import; $prebill_AAVarImp = $prebillData->AA_VAT_Import; $prebill_AATotImp = $prebillData->AA_Total_Import; $prebill_InvoNumb = $booksInvoiceNumber != ""? $booksInvoiceNumber : $prebillData->invoice_number; $prebill_SubTot_FD = $prebillData->FD_Subtotal_Import; $prebill_DisNoVat = $prebillData->FD_Disb_Not_VAT ?? 0; $prebill_BSTotPre = $prebillData->BS_Tot_Presup ?? 0; $prebill_BSTotCar = $prebillData->BS_Tot_Cargos ?? 0; $prebill_BSTotNot = $prebillData->BS_Tot_ThisN ?? 0; $prebill_BSTotDis = $prebillData->BS_Tot_Dispon ?? 0; $prebill_withBudget = $prebillData->with_Budget ?? 0; // resumenes para el reporte $prebill_SummPro = json_decode("[".$prebillData->Project_Summary."]"); $prebill_SummTks = json_decode("[".$prebillData->Timekeeper_Summary."]"); $prebill_SummCha = json_decode("[".$prebillData->Charges_Summary."]"); $prebill_SummHFi = json_decode("[".$prebillData->Fixed_Fees_Summary."]"); $prebill_SummBud = json_decode("[".$prebillData->Budget_Summary."]"); $sMonTot = substr($prebill_currency,0,3); $sConducto = ((array)$prebillData)["Client.Conducto"] ?? null; /********************************************************* * Obtención de tiempos relacionados a la Orden de Cobro *********************************************************/ $getRelatedTimes = makeCurlRequest( "https://www.zohoapis.com/creator/v2.1/data/$creatorAppOwner/$creatorAppName/report/For_Sincronize_Times?criteria=(Prebills=$recordId)", 'GET', [ "Authorization: Zoho-oauthtoken $creatorAccessToken", ] ); // Decodificar JSON $getRelatedTimes = json_decode($getRelatedTimes); // se valida respuesta de la solicitud de obtención de datos de prebill if(isset($getRelatedTimes->error)) { header('Content-Type: application/json'); http_response_code(500); echo json_encode(['status' => 'error', 'message' => 'error trying to get related times data']); exit; } $relatedTimes = $array->data ?? array(); /********************************************************* * Obtención de gastos relacionados a la Orden de Cobro *********************************************************/ $getRelatedDisbursements = makeCurlRequest( "https://www.zohoapis.com/creator/v2.1/data/$creatorAppOwner/$creatorAppName/report/Disbursements_Query?criteria=(Prebills=$recordId)", 'GET', [ "Authorization: Zoho-oauthtoken $creatorAccessToken", ] ); // Decodificar JSON $getRelatedDisbursements = json_decode($getRelatedDisbursements); // se valida getRelatedDisbursements de la solicitud de obtención de datos de prebill if(isset($getRelatedDisbursements->error)) { header('Content-Type: application/json'); http_response_code(500); echo json_encode(['status' => 'error', 'message' => 'error trying to get related disbursements data']); exit; } $relatedDisbursements = $getRelatedDisbursements->data; /***************************************************************** * Obtención de honorarios fijos relacionados a la Orden de Cobro *****************************************************************/ $getRelatedFixedFees = makeCurlRequest( "https://www.zohoapis.com/creator/v2.1/data/$creatorAppOwner/$creatorAppName/report/Fixed_Fees_Query?criteria=(Prebills=$recordId)'", 'GET', [ "Authorization: Zoho-oauthtoken $creatorAccessToken", ] ); // Decodificar JSON $getRelatedFixedFees = json_decode($getRelatedFixedFees); // se valida getRelatedDisbursements de la solicitud de obtención de datos de prebill if(isset($getRelatedFixedFees->error)) { header('Content-Type: application/json'); http_response_code(500); echo json_encode(['status' => 'error', 'message' => 'error trying to get related fixed fees data']); exit; } $relatedFixedFees = $getRelatedFixedFees->data ?? array(); /******************************************************** * Definición de constantes para etiquetas del reporte ********************************************************/ $SendaArchsGraf = "archs_graf/"; $SendaArchsCFDI = "archs_cfdi/"; $NomArchPDF = $prebill_InvoNumb."_DETALLE_DETAIL.pdf"; $lblOrdCob = "DETALLE DE SERVICIOS"; $lblNumero = "Número"; $lblFecha = "Fecha"; $lblClient = "Cliente"; $lblResPro = "RESUMEN POR PROYECTO"; $lblNombre = "Nombre"; $lblHoras = "Horas"; $lblHonora = "Honorarios"; $lblHONORA = "HONORARIOS"; $lblCargos = "Gastos"; $lblTotale = "T O T A L E S"; $lblResAbo = "RESUMEN POR ABOGADO"; $lblAbogad = "Abogado"; $lblCatego = "Categoría"; $lblResCar = "RESUMEN POR TIPO DE CARGO"; $lblDescri = "Descripción"; $lblImport = "Importe"; $lblAboFec = "Abogado & Fecha Descripción"; $lblTarifa = "Tarifa"; $lblTotHon = "Total Honorarios"; $lblCarGas = "GASTOS"; $lblCantid = "Cantidad"; $lblTotCar = "Total Gastos"; $lblSubTot = "Sub Total"; $lblImpVal = "I.V.A."; $lblTotals = "Total"; $lblPractic = "Practica"; $lblSupervi = "Supervisor"; $lblHonoFij = "H. Fijos"; $lblResPres = "RESUMEN DEL PRESUPUESTO POR PROYECTO"; $lblProyect = "Proyecto"; $lblPresupu = "Presupuesto"; $lblCargoss = "Facturado"; $lblEstaNot = "Esta nota"; $lblDisponi = "Disponible"; $lblResHonF = "RESUMEN DE HONORARIOS FIJOS POR TAREA"; $lblHonFijo = "HONORARIOS FIJOS"; $lblTotHFij = "Total H. Fijos"; $lblDesctos = "Descuento"; $lblAjustes = "Ajuste"; $lblTotHonHor = "Honorarios por Hora"; $lblTotHonFij = "Honorarios Fijos"; $lblSubTotHon = "Sub-Total de Honorarios"; $lblTotGastos = "Gastos"; $lblSubTotals = "Sub Total"; $lblSubConIVA = "Sub-Total con IVA"; $lblDisHonTie = "Descuento Honorarios por Hora"; $lblDisHonFij = "Descuento Honorarios Fijos"; $lblHonFijDis = "Descto HF"; $lblHonTieDis = "Descto H"; $lblConducto = "Conducto"; $lblEliteFact = "Factura"; $lblDisbNoVat = "Tasas Oficiales"; if($language == 2) { $lblOrdCob = "SERVICES DETAIL"; $lblNumero = "Number"; $lblFecha = "Date"; $lblClient = "Client"; $lblResPro = "SUMMARY BY PROJECT"; $lblNombre = "Name"; $lblHoras = "Hours"; $lblHonora = "Fees"; $lblHONORA = "FEES"; $lblCargos = "Expenses"; $lblTotale = "T O T A L S"; $lblResAbo = "SUMMARY BY TIMEKEEPER"; $lblAbogad = "Timekeeper"; $lblCatego = "Category"; $lblResCar = "SUMMARY BY TYPE OF EXPENSES"; $lblDescri = "Description"; $lblImport = "Import"; $lblAboFec = "Timekeeper & Date Description"; $lblTarifa = "Rate"; $lblTotHon = "Total Fees"; $lblCarGas = "EXPENSES"; $lblCantid = "Quantity"; $lblTotCar = "Total Expenses"; $lblSubTot = "Subtotal"; $lblImpVal = "V.A.T."; $lblTotals = "Total"; $lblPractic = "Practice"; $lblSupervi = "Supervisor"; $lblHonoFij = "F. Fixed"; $lblResPres = "BUDGET BY PROJECT"; $lblProyect = "Project"; $lblPresupu = "Budget"; $lblCargoss = "Billed"; $lblEstaNot = "This note"; $lblDisponi = "Available"; $lblResHonF = "SUMMARY OF FIXED FEES BY TASK"; $lblHonFijo = "FIXED FEES"; $lblTotHFij = "Total Fixed Fees"; $lblDesctos = "Discount"; $lblAjustes = "Adjustment"; $lblTotHonHor = "Hourly Fees"; $lblTotHonFij = "Fixed Fees"; $lblSubTotHon = "Sub-Total Fees"; $lblTotGastos = "Expenses"; $lblSubTotals = "Subrotal"; $lblSubConIVA = "Sub-Total with VAT"; $lblDisHonTie = "Discount Hourly Fees"; $lblDisHonFij = "Discount Fixed Fees"; $lblHonFijDis = "Disc. HF"; $lblHonTieDis = "Disc. H"; $lblConducto = "Agent"; $lblEliteFact = "Invoice"; $lblDisbNoVat = "Official Fees"; } $GLOBALS['footOne'] = $prebill_FootOne; $GLOBALS['footTwo'] = $prebill_FootTwo; $GLOBALS['footTre'] = utf8_decode($prebill_SupName)." (".utf8_decode($prebill_SupMail).") "; /********************************************************************* * Creación de objeto con datos básicos del reporte *********************************************************************/ class PDF extends FPDF { function Header() {} function Footer() { $this->SetTextColor(81,81,81); $this->SetFont('arial','',6); $this->SetXY(1.0,20.5); $this->MultiCell(26, 0.25, utf8_decode($GLOBALS['footOne']), 0, 'C', 0); $this->SetTextColor(81,81,81); $this->SetFont('arial','',6); $this->SetXY(1.0,$this->GetY()); $this->Cell(26, 0.25, utf8_decode($GLOBALS['footTwo']), 0, 1,'C', 0); $this->SetTextColor(81,81,81); $this->SetFont('arial','',6); $this->SetXY(1.0,$this->GetY()); $this->Cell(26, 0.25, utf8_decode($GLOBALS['footTre']), 0, 1,'C', 0); $this->SetTextColor(0,0,0); $this->SetFont('arial','',9); $this->SetXY(25.0,20.5); $this->Cell(1.5, 0.25, $this->PageNo().'/{nb}', 0, 1,'R', 0); } } /********************************************************************* * Construcción de documento pdf *********************************************************************/ $pdf=new PDF('L','cm','Letter'); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->AddFont('IDAutomationHC39M','','IDAutomationHC39M.php'); $pdf->AddFont('verdana','','verdana.php'); $pdf->SetAutoPageBreak(true); $pdf->SetMargins(0, 0, 0); $pdf->SetLineWidth(0.02); $pdf->SetFillColor(0,0,0); /********************************************************************* * Generación de encabezado de la factura *********************************************************************/ $X = 0; $Y = 0; $pdf->SetTextColor(68,133,184); $pdf->SetFont('arial','B',16); $pdf->SetXY($X+23.1,$Y+1.20+0.1); $pdf->Cell(3.5, 0.25, $lblOrdCob, 0, 1,'R', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','B',10); //$pdf->SetXY($X+17-0,$Y+1.96); $pdf->SetXY($X+22.5,$Y+1.96); $pdf->Cell(2.5, 0.25, utf8_decode($lblNumero), 0, 1,'L', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','B',12); $pdf->SetXY($X+25.3,$Y+1.95); $pdf->Cell(1.25, 0.25, $prebill_number, 0, 1,'R', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','B',10); $pdf->SetXY($X+22.5,$Y+2.5); $pdf->Cell(2.5, 0.25, utf8_decode($lblEliteFact), 0, 1,'L', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','B',12); $pdf->SetXY($X+25.3,$Y+2.5); $pdf->Cell(1.25, 0.25, $prebill_InvoNumb, 0, 1,'R', 0); $pdf->SetTextColor(140,133,169); $pdf->SetFont('arial','B',9); $pdf->SetXY($X+22.5,$Y+2.95); $pdf->Cell(2, 0.25, utf8_decode($lblFecha), 0, 1,'L', 0); $pdf->SetTextColor(140,133,169); $pdf->SetFont('arial','B',9); $pdf->SetXY($X+24.5,$Y+2.95); $pdf->MultiCell(9.4, 0.25, $prebill_date, 0, 'L'); $pdf->SetTextColor(140,133,169); $pdf->SetFont('arial','B',9); $pdf->SetXY($X+22.5,$Y+3.40); $pdf->Cell(2, 0.25, utf8_decode($lblClient), 0, 1,'L', 0); $pdf->SetTextColor(140,133,169); $pdf->SetFont('arial','B',9); $pdf->SetXY($X+24.5,$Y+3.40); $pdf->MultiCell(2.0, 0.25, utf8_decode($prebill_NumClie), 0, 'R'); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',16); $pdf->SetXY($X+1,$Y+1.20+0.1); $pdf->Cell(14.5, 0.25, utf8_decode($clientName), 0, 1,'L', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','',10); $pdf->SetXY($X+1,$Y+1.70+0.1); $pdf->Cell(4.5, 0.25, utf8_decode($clientAddress1), 0, 1,'L', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','',10); $pdf->SetXY($X+1,$Y+2.20+0.1); $pdf->Cell(4.5, 0.25, utf8_decode($clientAddress2), 0, 1,'L', 0); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','',10); $pdf->SetXY($X+1,$Y+2.70+0.1); $pdf->Cell(4.5, 0.25, utf8_decode($clientAddress3), 0, 1,'L', 0); if($sConducto != "") { $pdf->SetTextColor(140,133,169); $pdf->SetFont('arial','',10); $pdf->SetXY($X+1,$Y+3.7); $pdf->Cell(1, 0.25, utf8_decode($lblConducto), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',13); $pdf->SetXY($X+1,$Y+4.1); $pdf->MultiCell(21.00, 0.45, $sConducto, 0, 'L'); } $pdf->SetTextColor(140,133,169); $pdf->SetFont('arial','',10); $pdf->SetXY($X+1,$Y+4.7); $pdf->Cell(1, 0.25, utf8_decode($lblClient), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',13); $pdf->SetXY($X+1,$Y+5.1); $pdf->MultiCell(21.00, 0.45, utf8_decode($prebill_RazSoci), 0, 'L'); $pdf->SetTextColor(56,58,58); $pdf->SetFont('arial','B',10); $pdf->SetXY($X+1,$Y+6.0); $pdf->MultiCell(8.6, 0.45, $prebill_currency, 0, 'L'); $X = $X; $Y = $Y+4; $Puntero = $Y; /********************************************************************* * Resumen por proyecto *********************************************************************/ $X = $X; $Y = $Y+1; $Puntero = $pdf->GetY(); if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 2.5; } $TotRegsTie = count($prebill_SummPro); if($TotRegsTie > 0){ $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+1.5; $pdf->SetFont('arial','',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(11.5, 0.60, $lblResPro, 0, 1,'L', 0); $Y = $Y+0.7; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(7.0, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(7.0, 0.60, $lblNombre, 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(8.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.00, 0.60, $lblPractic, 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(10.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.00, 0.60, $lblHoras, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(12.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonora, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(14.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonTieDis, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(17.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonoFij, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(19.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonFijDis, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(22.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblCargos, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblTotals, 0, 1,'R', 1); $Y = $Y+0.7; $Puntero = $Y; if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 2.5; } for ($i = 0; $i < $TotRegsTie; $i++){ $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(8.0,$Y); $pdf->Cell(2.00, 0.30, substr(utf8_decode($prebill_SummPro[$i]->Practica),0,10), 0, 1,'L', 0); $pdf->SetXY(10.0,$Y); $pdf->Cell(2.00, 0.30, number_format($prebill_SummPro[$i]->TotHrs,2), 0, 1,'R', 0); $pdf->SetXY(12.0,$Y); $pdf->Cell(2.50, 0.30, $prebill_SummPro[$i]->TotImp, 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(14.5,$Y); $pdf->Cell(2.50, 0.30, $prebill_SummPro[$i]->TotAjH, 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.50, 0.30, $prebill_SummPro[$i]->TotFix, 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(19.5,$Y); $pdf->Cell(2.50, 0.30, $prebill_SummPro[$i]->TotAjF, 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetXY(22.0,$Y); $pdf->Cell(2.50, 0.30, $prebill_SummPro[$i]->TotDis, 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, $prebill_SummPro[$i]->TotTot, 0, 1,'R', 0); $pdf->SetXY(1.0,$Y); $pdf->MultiCell(7.0, 0.30, utf8_decode($prebill_SummPro[$i]->Name), 0, 'L', 0); $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero > 19.0) { if ($TotRegsTie>$Regs) { $pdf->AddPage(); //TitulosTie($pdf, 1.5, $lblAboFec, $lblHoras, $lblTarifa, $lblImport); //TitulosTie($pdf, 1.5); $Y = 2.43; } else { $pdf->AddPage(); $Y = 2.5; } } } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(9.0, 0.60, $lblTotale, 0, 1,'R', 1); $pdf->SetXY(10.0,$Y); $pdf->Cell(2.00, 0.60, number_format($prebill_Factur,2), 0, 1,'R', 1); $pdf->SetXY(12.0,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_Fees,2), 0, 1,'R', 1); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->SetTextColor(255,0,0); $pdf->SetXY(14.5,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_FeesAlia,2), 0, 1,'R', 1); } else { $pdf->SetTextColor(255,0,0); $pdf->SetXY(14.5,$Y); $pdf->Cell(2.50, 0.60, "0.00", 0, 1,'R', 1); } $pdf->SetTextColor(0,0,0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_Fixed,2), 0, 1,'R', 1); $pdf->SetTextColor(255,0,0); $pdf->SetXY(19.5,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_FFeesAli,2), 0, 1,'R', 1); $pdf->SetTextColor(0,0,0); $pdf->SetXY(22.0,$Y); //$TotRegsTie = count($prebill_SummPro); if(count($prebill_SummPro) > 0 and $creatorAppName == "alate-espana"){ $prebill_Disbur = $prebill_SummPro[0]->TotDis; } //echo $prebill_Disbur; $pdf->Cell(2.45, 0.60, number_format($prebill_Disbur,2), 0, 1,'R', 1); $pdf->SetXY(24.5,$Y); //$pdf->Cell(2.45, 0.60, number_format($prebill_SubTot,2), 0, 1,'R', 1); if(count($prebill_SummPro) > 0 and $creatorAppName == "alate-espana"){ $prebill_SubTot_FD = $prebill_SummPro[0]->TotTot; } $pdf->Cell(2.45, 0.60, $prebill_SubTot_FD, 0, 1,'R', 1); } /*********************************************** * Resumen por Abogado ***********************************************/ $X = $X; $Y = $Y+1; $Puntero = $Y; if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 1.5; } $TotRegsTie = count($prebill_SummTks); if($TotRegsTie > 0) { $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $pdf->SetFont('arial','',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(7.0, 0.60, $lblResAbo, 0, 1,'L', 0); $Y = $Y+0.7; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(5.50, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.0,$Y); $pdf->Cell(5.50, 0.60, $lblAbogad, 0, 1,'L', 1); $pdf->SetXY(1.0,$Y); $pdf->SetXY(6.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(3.5, 0.60, utf8_decode($lblCatego), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(10.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.00, 0.60, $lblHoras, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(12.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonora, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(14.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonTieDis, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(17.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonoFij, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(19.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonFijDis, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(22.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblCargos, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblTotals, 0, 1,'R', 1); $Y = $Y+0.7; $Puntero = $Y; if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 2.5; } for ($i = 0; $i < $TotRegsTie; $i++){ $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(5.25, 0.30, utf8_decode($prebill_SummTks[$i]->Name), 0, 1,'L', 0); $pdf->SetXY(6.5,$Y); $pdf->Cell(3.5, 0.30, utf8_decode($prebill_SummTks[$i]->Category), 0, 1,'L', 0); $pdf->SetXY(10.0,$Y); $pdf->Cell(2.00, 0.30, $prebill_SummTks[$i]->TotHrs, 0, 1,'R', 0); $pdf->SetXY(12.0,$Y); $pdf->Cell(2.50, 0.30, number_format($prebill_SummTks[$i]->TotImp,2), 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(14.5,$Y); $pdf->Cell(2.50, 0.30, number_format($prebill_SummTks[$i]->TotAjH,2), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.50, 0.30, number_format($prebill_SummTks[$i]->TotFix,2), 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(19.5,$Y); $pdf->Cell(2.50, 0.30, number_format($prebill_SummTks[$i]->TotAjF,2), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetXY(22.0,$Y); $pdf->Cell(2.50, 0.30, number_format($prebill_SummTks[$i]->TotDis,2), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($prebill_SummTks[$i]->TotTot,2), 0, 1,'R', 0); $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 2.50; } } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(9.0, 0.60, $lblTotale, 0, 1,'R', 1); $pdf->SetXY(10.0,$Y); $pdf->Cell(2.00, 0.60, number_format($prebill_Factur,2), 0, 1,'R', 1); $pdf->SetXY(12.0,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_Fees,2), 0, 1,'R', 1); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->SetTextColor(255,0,0); $pdf->SetXY(14.5,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_FeesAlia,2), 0, 1,'R', 1); } else { $pdf->SetTextColor(255,0,0); $pdf->SetXY(14.5,$Y); $pdf->Cell(2.50, 0.60, "0.00", 0, 1,'R', 1); } $pdf->SetTextColor(0,0,0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_Fixed,2), 0, 1,'R', 1); $pdf->SetTextColor(255,0,0); $pdf->SetXY(19.5,$Y); $pdf->Cell(2.50, 0.60, number_format($prebill_FFeesAli,2), 0, 1,'R', 1); $pdf->SetTextColor(0,0,0); $pdf->SetXY(22.0,$Y); $pdf->Cell(2.45, 0.60, number_format($prebill_Disbur,2), 0, 1,'R', 1); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.60, $prebill_SubTot_FD, 0, 1,'R', 1); } /********************************************* * Resumen de Honorarios Fijos por Tarea *********************************************/ $X = $X; $Y = $Y+1; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $TotRegsTie = count($prebill_SummHFi); if($TotRegsTie > 0){ $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $pdf->SetFont('arial','',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(12.0, 0.60, $lblResHonF, 0, 1,'L', 0); $Y = $Y+0.7; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(23.5, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(23.5, 0.60, utf8_decode($lblDescri), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(19.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonoFij, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(22.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblHonFijDis, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblImport, 0, 1,'R', 1); $Y = $Y+0.7; $Puntero = $Y; if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 2.5; } for ($i = 0; $i < $TotRegsTie; $i++){ $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(19.5,$Y); $pdf->Cell(2.5, 0.30, number_format($prebill_SummHFi[$i]->TotFix,2), 0, 1,'R', 0); $pdf->SetXY(22.0,$Y); $pdf->Cell(2.5, 0.30, number_format($prebill_SummHFi[$i]->TotAjF,2), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($prebill_SummHFi[$i]->TotTot,2), 0, 1,'R', 0); $pdf->SetXY(1.25,$Y); $pdf->MultiCell(23.5, 0.30, utf8_decode($prebill_SummHFi[$i]->Name), 0, 'L', 0); $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 2.50; } } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(23.5, 0.60, $lblTotale, 0, 1,'R', 1); $pdf->SetXY(19.5,$Y); $pdf->Cell(2.5, 0.60, number_format($prebill_Fixed,2), 0, 1,'R', 1); $pdf->SetTextColor(255,0,0); $pdf->SetXY(22.0,$Y); $pdf->Cell(2.5, 0.60, number_format($prebill_FFeeDis,2), 0, 1,'R', 1); $pdf->SetTextColor(0,0,0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.60, number_format($prebill_Fixed - $prebill_FFeeDis,2), 0, 1,'R', 1); } /********************************************** * Resumen por cargos *********************************************/ $X = $X; $Y = $Y+1; $Puntero = $Y; if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 1.5; } $TotRegsTie = count($prebill_SummCha); if($TotRegsTie > 0){ $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $pdf->SetFont('arial','',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(12.0, 0.60, $lblResCar, 0, 1,'L', 0); $Y = $Y+0.7; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(23.5, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(23.5, 0.60, utf8_decode($lblDescri), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblImport, 0, 1,'R', 1); $Y = $Y+0.7; $Puntero = $Y; if ($Puntero > 19.0) { $pdf->AddPage(); $Y = 2.5; } for ($i = 0; $i < $TotRegsTie; $i++){ $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, $prebill_SummCha[$i]->TotDis, 0, 1,'R', 0); $pdf->SetXY(1.25,$Y); $pdf->MultiCell(23.5, 0.30, utf8_decode($prebill_SummCha[$i]->Name), 0, 'L', 0); $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 2.50; } } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(23.5, 0.60, $lblTotale, 0, 1,'R', 1); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.60, number_format($prebill_Disbur,2), 0, 1,'R', 1); } /********************************************** * Registro de tiempos **********************************************/ $TotRegsTie = count($relatedTimes); $TotRegsGas = count($relatedDisbursements); $TotRegsFix = count($relatedFixedFees); if($TotRegsTie > 0){ $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $Regs = 0; $RefAgregPag = 0; $pdf->SetFont('arial','',12); $pdf->SetXY(1.0,$Y); $pdf->SetTextColor(0,0,0); $pdf->Cell(19.5, 0.75, $lblHONORA, 0, 1,'L', 0); $Y = $Y+1.3; TitulosTie($pdf, $Y-0.8, $lblAboFec, $lblHoras, $lblTarifa, $lblImport); $Y = $Y + 0.17; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $sProyecto = ""; $sIDProyec = ""; $sDescProy = ""; $sRefCliente = ""; $sRefAgente = ""; $nTotImpor = 0.00; $nTotHoras = 0.00; $nTotDisco = 0.00; $iSubTotal = 0; for ($i = 0; $i < $TotRegsTie; $i++) { $lImpReg = true; // Checamos si es españa if($creatorAppName == "alate-espana") { if($relatedTimes[$i]->dHours <= 0) { $lImpReg = false; } } if($relatedTimes[$i]->Imprimir == "true" && $lImpReg == true) { if($sProyecto != $relatedTimes[$i]->Matter) { if($iSubTotal != 0) { $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblSubTotals), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblDesctos), 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotDisco,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals), 0, 1,'R', 0); $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($nTotHoras,2), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor - $nTotDisco,2), 0, 1,'R', 0); } else { $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals." ".$sIDProyec), 0, 1,'R', 0); $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($nTotHoras,2), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); } $Y = $Y + 0.48; $nTotImpor = 0.00; $nTotHoras = 0.00; $nTotDisco = 0.00; } $iSubTotal = 1; $sProyecto = $relatedTimes[$i]->Matter; foreach ( $relatedTimes[$i] as $nombre => $hexa ) { if($nombre == "Matter.Identity") { $sIDProyec = $hexa; } if($nombre == "Matter.Description") { $sDescProy = $hexa; } if($nombre == "Matter.Ref_Cliente") { $sRefCliente = $hexa; } if($nombre == "Matter.Referencia_Agente") { $sRefAgente = $hexa; } } $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetXY(1.0,$Y-0.05); $pdf->SetFillColor(187,187,187); $pdf->Cell(25.95, 0.40, "", 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); //$pdf->Cell(24.50, 0.30, substr(utf8_decode(trim($relatedTimes[$i]->Matter)),0,90), 0, 1,'L', 0); //$Y = $Y + 0.48; $pdf->MultiCell(25.95, 0.30, utf8_decode(trim($sIDProyec." ".$sDescProy." R.Agt.: ".$sRefAgente." R.Clte.: ".$sRefCliente)), 0, 'L', 1); $YY = $pdf->GetY()+0.18; $Y = $YY; } if($prebill_Ajustada == true && $prebill_TipoMovi == "Ajuste" ) { $nTotImpor = $nTotImpor + $relatedTimes[$i]->Importe_Alias; $nTotHoras = $nTotHoras + $relatedTimes[$i]->Horas_Alias; $nTotDisco = 0; } else { $nTotImpor = $nTotImpor + $relatedTimes[$i]->Import; $nTotHoras = $nTotHoras + $relatedTimes[$i]->dHours; $nTotDisco = $nTotDisco + $relatedTimes[$i]->Importe_Alias; } // if($relatedTimes[$i]->Imprimir == "true") // { $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.25,$Y); $pdf->Cell(18.0, 0.30, utf8_decode($relatedTimes[$i]->Timekeeper->Name), 0, 1,'L', 0); if($prebill_Ajustada == true && $prebill_TipoMovi == "Ajuste" ) { $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($relatedTimes[$i]->Horas_Alias,2), 0, 1,'R', 0); } else { $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($relatedTimes[$i]->dHours,2), 0, 1,'R', 0); } $pdf->SetXY(22.00,$Y); $pdf->Cell(2.50, 0.30, number_format($relatedTimes[$i]->Rate,2), 0, 1,'R', 0); if($prebill_Ajustada == true && $prebill_TipoMovi == "Ajuste" ) { $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($relatedTimes[$i]->Importe_Alias,2), 0, 1,'R', 0); } else { $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($relatedTimes[$i]->Import,2), 0, 1,'R', 0); } $pdf->SetTextColor(140,133,169); $pdf->SetXY(1.25,$Y+0.30); if($relatedTimes[$i]->Reference_Number != "") { $pdf->MultiCell(18.5, 0.30, utf8_decode($relatedTimes[$i]->WorkDate." ".trim($relatedTimes[$i]->Description." REF.: ".$relatedTimes[$i]->Reference_Number)), 0, 'L', 0); } else { $pdf->MultiCell(18.5, 0.30, utf8_decode($relatedTimes[$i]->WorkDate." ".trim($relatedTimes[$i]->Description)), 0, 'L', 0); } $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); } $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.50; } } if($iSubTotal != 0) { $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblSubTotals), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblDesctos), 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotDisco,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals), 0, 1,'R', 0); $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($nTotHoras,2), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor - $nTotDisco,2), 0, 1,'R', 0); } else { $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals." ".$sIDProyec), 0, 1,'R', 0); $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($nTotHoras,2), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); } $nTotImpor = 0.00; $nTotHoras = 0.00; $nTotDisco = 0.00; } $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',9); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(23.5, 0.60, $lblTotHon, 0, 1,'R', 1); $pdf->SetXY(24.5,$Y); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->Cell(2.45, 0.60, number_format($prebill_Fees - $prebill_FeesAlia,2), 0, 1,'R', 1); } else { $pdf->Cell(2.45, 0.60, number_format($prebill_Fees,2), 0, 1,'R', 1); } } /********************************************** * Registro de honorarios fijos *********************************************/ if($TotRegsFix > 0){ $Y = $pdf->GetY()+0.20; $Y = $Y+1.0; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $Regs = 0; $RefAgregPag = 0; $pdf->SetFont('arial','',12); $pdf->SetXY(1.0,$Y); $pdf->SetTextColor(0,0,0); $pdf->Cell(19.5, 0.75, $lblHonFijo, 0, 1,'L', 0); $Y = $Y+1.3; TitulosGas($pdf, $Y-0.8, $lblAboFec, $lblCantid, $lblTarifa, $lblImport); $Y = $Y + 0.17; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $sProyecto = ""; $sIDProyec = ""; $sDescProy = ""; $sRefCliente = ""; $sRefAgente = ""; $nTotImpor = 0.00; $nTotHoras = 0.00; $nTotDisco = 0.00; $iSubTotal = 0; for ($i = 0; $i < $TotRegsFix; $i++){ if($relatedFixedFees[$i]->Imprimir == "true") { if($sProyecto != $relatedFixedFees[$i]->Matter) { if($iSubTotal != 0) { $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblSubTotals), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblDesctos), 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotDisco,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor - $nTotDisco,2), 0, 1,'R', 0); } else { if ($nTotImpor > 0.00) { $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals." ".$sIDProyec), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); } } $Y = $Y + 0.48; $nTotImpor = 0.00; $nTotHoras = 0.00; $nTotDisco = 0.00; } $sProyecto = $relatedFixedFees[$i]->Matter; $iSubTotal = 1; foreach ( $relatedFixedFees[$i] as $nombre => $hexa ) { if($nombre == "Matter.Identity") { $sIDProyec = $hexa; } if($nombre == "Matter.Description") { $sDescProy = $hexa; } if($nombre == "Matter.Ref_Cliente") { $sRefCliente = $hexa; } if($nombre == "Matter.Referencia_Agente") { $sRefAgente = $hexa; } } $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetXY(1.0,$Y-0.05); $pdf->SetFillColor(187,187,187); $pdf->Cell(25.95, 0.40, "", 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); //$pdf->Cell(24.5, 0.30, substr(utf8_decode(trim($relatedFixedFees[$i]->Matter)),0,90), 0, 1,'L', 0); //$Y = $Y + 0.48; $pdf->MultiCell(25.95, 0.30, utf8_decode(trim($sIDProyec." ".$sDescProy." R.Agt.: ".$sRefAgente." R.Clte.: ".$sRefCliente)), 0, 'L', 1); $YY = $pdf->GetY()+0.18; $Y = $YY; } $nTotImpor = $nTotImpor + $relatedFixedFees[$i]->Import; $nTotDisco = $nTotDisco + $relatedFixedFees[$i]->Importe_Alias; $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.25,$Y); $pdf->Cell(18.5, 0.30, utf8_decode($relatedFixedFees[$i]->Timekeeper->Name), 0, 1,'L', 0); $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($relatedFixedFees[$i]->Quantity,2), 0, 1,'R', 0); $pdf->SetXY(22.00,$Y); $pdf->Cell(2.50, 0.30, number_format($relatedFixedFees[$i]->Cost_Unit,2), 0, 1,'R', 0); $pdf->SetXY(24.50,$Y); $pdf->Cell(2.45, 0.30, number_format($relatedFixedFees[$i]->Import,2), 0, 1,'R', 0); $pdf->SetTextColor(140,133,169); $pdf->SetXY(1.25,$Y+0.30); if($relatedFixedFees[$i]->Reference_Number != "") { $pdf->MultiCell(18.5, 0.30, utf8_decode($relatedFixedFees[$i]->WorkDate." ".trim($relatedFixedFees[$i]->Description." REF.: ".$relatedFixedFees[$i]->Reference_Number)), 0, 'L', 0); } else { $pdf->MultiCell(18.5, 0.30, utf8_decode($relatedFixedFees[$i]->WorkDate." ".trim($relatedFixedFees[$i]->Description)), 0, 'L', 0); } $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } } if($iSubTotal != 0) { $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblSubTotals), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblDesctos), 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotDisco,2), 0, 1,'R', 0); $Y = $Y + 0.48; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor - $nTotDisco,2), 0, 1,'R', 0); } else { $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals." ".$sIDProyec), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); } $Y = $Y + 0.48; $nTotImpor = 0.00; $nTotHoras = 0.00; $nTotDisco = 0.00; } } $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',9); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(23.5, 0.60, $lblTotHFij, 0, 1,'R', 1); $pdf->SetXY(24.50,$Y); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->Cell(2.45, 0.60, number_format($prebill_Fixed - $prebill_FFeesAli,2), 0, 1,'R', 1); } else { $pdf->Cell(2.45, 0.60, number_format($prebill_Fixed,2), 0, 1,'R', 1); } } /********************************************** * Registro de gastos **********************************************/ if($TotRegsGas > 0){ $Y = $pdf->GetY()+0.20; $Y = $Y+1.0; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $Regs = 0; $RefAgregPag = 0; $pdf->SetFont('arial','',12); $pdf->SetXY(1.0,$Y); $pdf->SetTextColor(0,0,0); $pdf->Cell(19.5, 0.75, $lblCarGas, 0, 1,'L', 0); $Y = $Y+1.3; TitulosGas($pdf, $Y-0.8, $lblAboFec, $lblCantid, $lblTarifa, $lblImport); $Y = $Y + 0.17; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $sProyecto = ""; $sIDProyec = ""; $sDescProy = ""; $sRefCliente = ""; $sRefAgente = ""; $nTotImpor = 0.00; $nTotHoras = 0.00; $iSubTotal = 0; for ($i = 0; $i < $TotRegsGas; $i++){ if($relatedDisbursements[$i]->Imprimir == "true") { if($sProyecto != $relatedDisbursements[$i]->Matter->Name) { // echo "Proyecto: " . $relatedDisbursements[$i]->Matter->Name; // exit; if($iSubTotal != 0) { echo "Entré: " . $iSubTotal; exit; $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals." ".$sIDProyec), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); $Y = $Y + 0.48; $nTotImpor = 0.00; $nTotHoras = 0.00; } $sProyecto = $relatedDisbursements[$i]->Matter; $iSubTotal = 1; foreach ( $relatedDisbursements[$i] as $nombre => $hexa ) { if($nombre == "Matter.Identity") { $sIDProyec = $hexa; } if($nombre == "Matter.Description") { $sDescProy = $hexa; } if($nombre == "Matter.Ref_Cliente") { $sRefCliente = $hexa; } if($nombre == "Matter.Referencia_Agente") { $sRefAgente = $hexa; } } $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetXY(1.0,$Y-0.05); $pdf->SetFillColor(187,187,187); $pdf->Cell(25.95, 0.40, "", 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); //$pdf->Cell(24.5, 0.30, substr(utf8_decode(trim($relatedDisbursements[$i]->Matter)),0,90), 0, 1,'L', 0); //$Y = $Y + 0.48; $pdf->MultiCell(25.95, 0.30, utf8_decode(trim($sIDProyec." ".$sDescProy." R.Agt.: ".$sRefAgente." R.Clte.: ".$sRefCliente)), 0, 'L', 1); $YY = $pdf->GetY()+0.18; $Y = $YY; } $nTotImpor = $nTotImpor + $relatedDisbursements[$i]->Import; $pdf->SetFont('arial','',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.25,$Y); $nombreTK = isset($relatedDisbursements[$i]->Timekeeper->Name) ? $relatedDisbursements[$i]->Timekeeper->Name : ''; $pdf->Cell(18.50, 0.30, utf8_decode($nombreTK), 0, 1, 'L', 0); $pdf->SetXY(20.00,$Y); $pdf->Cell(2.00, 0.30, number_format($relatedDisbursements[$i]->Quantity,2), 0, 1,'R', 0); $pdf->SetXY(22.00,$Y); $pdf->Cell(2.50, 0.30, number_format($relatedDisbursements[$i]->Cost_Unit,2), 0, 1,'R', 0); $pdf->SetXY(24.50,$Y); $pdf->Cell(2.45, 0.30, number_format($relatedDisbursements[$i]->Import,2), 0, 1,'R', 0); $pdf->SetTextColor(140,133,169); $pdf->SetXY(1.25,$Y+0.30); if($relatedDisbursements[$i]->Reference_Number != "") { $pdf->MultiCell(18.50, 0.30, utf8_decode($relatedDisbursements[$i]->WorkDate." ".trim($relatedDisbursements[$i]->Description." REF.: ".$relatedDisbursements[$i]->Reference_Number)), 0, 'L', 0); } else { $pdf->MultiCell(18.50, 0.30, utf8_decode($relatedDisbursements[$i]->WorkDate." ".trim($relatedDisbursements[$i]->Description)), 0, 'L', 0); } $pdf->SetDrawColor(140,133,169); $pdf->line(1.0, $Y-0.1, 26.95, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } } } if($iSubTotal != 0) { $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',8); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.00,$Y); $pdf->Cell(19, 0.30, utf8_decode($lblTotals." ".$sIDProyec), 0, 1,'R', 0); $pdf->SetXY(24.5,$Y); $pdf->Cell(2.45, 0.30, number_format($nTotImpor,2), 0, 1,'R', 0); $Y = $Y + 0.48; $nTotImpor = 0.00; $nTotHoras = 0.00; } $Puntero = $Y; if ($Puntero>19.0) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',9); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(23.50, 0.60, $lblTotCar, 0, 1,'R', 1); $pdf->SetXY(24.50,$Y); $pdf->Cell(2.45, 0.60, number_format($prebill_Disbur,2), 0, 1,'R', 1); } /******************************************************* * Impresión de los subtotales de honorarios y gastos. *******************************************************/ if ($Puntero>10.00) { $pdf->AddPage(); $Y = 1.5; } else { $Y = $pdf->GetY()+0.50; } $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(23.50, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(23.50, 0.60, utf8_decode($lblTotale), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.50,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, ' ', 0, 1,'R', 1); $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblTotHonHor , 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_Fees,2), 0, 1,'R', 0); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $Y = $pdf->GetY()+0.10; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblDisHonTie , 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_FeesAlia,2), 0, 1,'R', 0); } $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblTotHonFij , 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_Fixed,2), 0, 1,'R', 0); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $Y = $pdf->GetY()+0.10; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblDisHonFij , 0, 1,'R', 0); $pdf->SetTextColor(255,0,0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_FFeesAli,2), 0, 1,'R', 0); } $Y = $pdf->GetY()+0.10; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetDrawColor(140,133,169); $pdf->line(24.0, $Y, 26.95, $Y); $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.00, 0.60, $lblSubTotHon , 0, 1,'R', 0); $pdf->SetXY(24.00,$Y); if($prebill_Ajustada == true && $prebill_TipoMovi == "Descuento" ) { $pdf->Cell(2.95, 0.60, number_format($prebill_Fees - $prebill_FeesAlia + $prebill_Fixed - $prebill_FFeesAli,2), 0, 1,'R', 0); } else { $pdf->Cell(2.95, 0.60, number_format($prebill_Fees + $prebill_Fixed,2), 0, 1,'R', 0); } $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblTotGastos , 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_Disbur,2), 0, 1,'R', 0); $Y = $pdf->GetY()+0.10; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetDrawColor(140,133,169); $pdf->line(24.0, $Y, 26.95, $Y); $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblSubTot, 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_SubTot,2), 0, 1,'R', 0); $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblImpVal." (".strval($prebill_PorIva)."%)", 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_ImpIva,2), 0, 1,'R', 0); $Y = $pdf->GetY()+0.10; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetDrawColor(140,133,169); $pdf->line(24.0, $Y, 26.95, $Y); $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblSubConIVA, 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_SubTot + $prebill_ImpIva,2), 0, 1,'R', 0); $Y = $pdf->GetY()+0.18; $Puntero = $Y; if ($Puntero>19.00) { $pdf->AddPage(); $Y = 1.5; } $pdf->SetFont('arial','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(1.0,$Y); $pdf->Cell(23.0, 0.60, $lblDisbNoVat, 0, 1,'R', 0); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_DisNoVat,2), 0, 1,'R', 0); $Y = $pdf->GetY()+0.18; $pdf->SetFont('arial','B',11); $pdf->SetTextColor(0,0,0); $pdf->SetXY(19.0,$Y); $pdf->SetFillColor(238,238,238); $pdf->Cell(5.0, 0.60, $lblTotals . " " . $sMonTot, 0, 1,'R', 1); $pdf->SetXY(24.0,$Y); $pdf->Cell(2.95, 0.60, number_format($prebill_Import,2), 0, 1,'R', 1); // // Establecer headers para la respuesta API // header('Content-Type: application/pdf'); // header('Content-Disposition: inline; filename="archivo.pdf"'); // header('Cache-Control: private, max-age=0, must-revalidate'); // header('Pragma: public'); // // Imprimir el PDF directamente al navegador // $pdf->Output('I'); // 'I' = inline // exit; ob_start(); // inicia buffer $pdf->Output(); $contenido = ob_get_clean(); // captura todo file_put_contents("debug_output.pdf", $contenido); // guarda en archivo local echo $contenido; // #============================================================================================================ // #== 2.6 SE GRABA EL DOCUMENTO .PDF EN EL DISCO DURO // #============================================================================================================ // $pdf->Output($SendaArchsCFDI.$NomArchPDF, 'F'); // //$pdf->Output('EC_' . $prebill_client . '-' . $prebill_number . '.pdf', 'F'); // #============================================================================================================ // #== 2.7 DESCOMENTAR SI ESTÁ UTILIZANDO EL SISTEMA OPERATIVO LINUX. // #============================================================================================================ // chmod ($SendaArchsCFDI.$NomArchPDF,0777); // #============================================================================================================ // # 2.9 Envio del Archivos a Zoho Creator // #============================================================================================================ // if($booksInvoiceId == "") // { // $file_name_with_full_path = '/var/www/html/aptusCFDIRF/archs_cfdi/'.$NomArchPDF; // //$request_url = 'https://creator.zoho.com/api/xml/fileupload/scope=creatorapi'; // $request_url = 'https://creator.zoho.com/api/v2/arochiylindner.aptus/alate/report/Prebills_Report/' . $recordId . '/File_PDF_OC/upload'; // // Checamos si es españa // if($creatorAppName == "alate-espana") // { // $request_url = 'https://creator.zoho.com/api/v2/arochiylindner.aptus/alate-espana/report/Prebills_Report/' . $recordId . '/File_PDF_OC/upload'; // } // if (function_exists('curl_file_create')) { // php 5.6+ // $cFile = curl_file_create($file_name_with_full_path); // } // else // { // $cFile = '@' . realpath($file_name_with_full_path); // } // $post = array( // // 'authtoken' => $authtoken_ZC, // // 'applinkname' => $creatorAppName, // // 'formname' => 'Prebills', // // 'fieldname' => 'File_PDF_OC', // // 'recordId' => $recordId, // // 'filename' => $NomArchPDF, // 'file'=> $cFile); // $ch = curl_init(); // curl_setopt($ch, CURLOPT_URL, $request_url); // // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_POST, true); // curl_setopt($ch, CURLOPT_POSTFIELDS, $post); // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $creatorAccessToken)); // $r = curl_exec($ch); // curl_close ($ch); // } // #============================================================================================================ // # 2.10 Envio del Archivos a Zoho Books // #============================================================================================================ // #JFA: Obtenemos el access token de Zoho Books // $bRefreshToken = $aDatPac["B_OAuth_refresh_token"]; // $bClientId = $aDatPac["B_OAuth_client_id"]; // $bClientSecret = $aDatPac["B_OAuth_client_secret"]; // $bRedirectUri = $aDatPac["B_OAuth_redirect_uri"]; // $bGrantType = $aDatPac["B_OAuth_grant_type"]; // $bAuthUrl = "https://accounts.zoho.com/oauth/v2/token"; // $boa_access_token = oauth('arochiylindner.aptus', 'ZBooks', $bRefreshToken, $bClientId, $bClientSecret, $bRedirectUri, $bGrantType, $bAuthUrl); // if($booksOrganizationId <> "" && $booksInvoiceId <> "") // { // $file_name_with_full_path = '/var/www/html/aptusCFDIRF/archs_cfdi/'.$NomArchPDF; // $request_url = 'https://www.zohoapis.com/books/v3/invoices/'.$booksInvoiceId.'/attachment?can_send_in_mail=true'; // if (function_exists('curl_file_create')) { // php 5.6+ // $cFile = curl_file_create($file_name_with_full_path); // } // else // { // $cFile = '@' . realpath($file_name_with_full_path); // } // $post = array( // // 'authtoken' => $authtoken_ZB, // 'organization_id' => $booksOrganizationId, // //'can_send_in_mail' => 'true', // 'attachment'=> $cFile); // $ch = curl_init(); // curl_setopt($ch, CURLOPT_URL, $request_url); // // curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_POST, true); // curl_setopt($ch, CURLOPT_POSTFIELDS, $post); // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $boa_access_token)); // $r = curl_exec($ch); // # Usamos la funcion curl_errno() para atrapar cualquier error relacionado con la llamada. // if (curl_errno($ch)) // { // $error_msg = curl_error($ch); // } // curl_close ($ch); // if (isset($error_msg)) // { // $j_array = array('code' => '666', 'message' => "Error en la llamada curl " . $error_msg); // $Resultado = json_encode($j_array); // echo $Resultado; // return; // } // else // { // $ra = json_decode($r); // $resultPDF = $ra->code.' - '.$ra->message; // $code = (int)$ra->code; // if ($code != 0) // { // $j_array = array('code' => $ra->code, 'message' => "No se pudo adjuntar el archivo a Books, contacte al administrador " . $ra->message); // $Resultado = json_encode($j_array); // echo $Resultado; // return; // } // } // } // $j_array = array('code' => "200", 'message' => "Proceso de creacion de Orden de Cobro fue exitoso. OCob No. ".$prebill_InvoNumb); // $Resultado = json_encode($j_array); // echo $Resultado; // return; #============================================================================================================ #== FUNCIONES GENERALES #============================================================================================================ function TitulosTie($pdf, $Y, $lblAboFec, $lblHoras, $lblTarifa, $lblImport){ $Y = $Y + 0.24; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(19.0, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(19.0, 0.60, utf8_decode($lblAboFec), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(20.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.00, 0.60, $lblHoras, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(22.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblTarifa, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblImport, 0, 1,'R', 1); } function TitulosGas($pdf, $Y, $lblAboFec, $lblCantid, $lblTarifa, $lblImport){ $Y = $Y + 0.24; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(19.0, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(19.0, 0.60, utf8_decode($lblAboFec), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(20.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.00, 0.60, $lblCantid, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(22.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.50, 0.60, $lblTarifa, 0, 1,'R', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(24.5,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblImport, 0, 1,'R', 1); }