p_name_ZC = $_REQUEST['pAppName']; } if (isset($_REQUEST['pAuthToken'])) { $authtoken_ZC = $_REQUEST['pAuthToken']; } if (isset($_REQUEST['pOrgaID'])) { $organi_id_ZB = $_REQUEST['pOrgaID']; } if (isset($_REQUEST['pAuthTokenZB'])) { $authtoken_ZB = $_REQUEST['pAuthTokenZB']; } if (isset($_REQUEST['pInvoiceID'])) { $invoiceID = $_REQUEST['pInvoiceID']; } if (isset($_REQUEST['pLang'])) { $language = $_REQUEST['pLang']; } if (isset($_REQUEST['pCiaName'])) { $ciaName = $_REQUEST['pCiaName']; } if (isset($_REQUEST['pCiaAddr1'])) { $ciaAddr1 = $_REQUEST['pCiaAddr1']; } if (isset($_REQUEST['pCiaAddr2'])) { $ciaAddr2 = $_REQUEST['pCiaAddr2']; } if (isset($_REQUEST['pCiaAddr3'])) { $ciaAddr3 = $_REQUEST['pCiaAddr3']; } if (isset($_REQUEST['pDatPac'])) { $bDatPac = $_REQUEST['pDatPac']; } if (isset($_REQUEST['pAppOwner'])) { $appOwner = $_REQUEST['pAppOwner']; // Parametros para el propietario de la aplicación } if($bRecId == "") { $j_array = array('code' => "310", "message" => "ERROR - [wsPreBillZohoBooks] Parametros incompletos para el Servicio Web, falta el ID de la Orden de Cobro"); $Resultado = json_encode($j_array); echo $Resultado; return; } if($app_name_ZC == "") { $j_array = array('code' => "320", "message" => "ERROR - [wsPreBillZohoBooks] Parametros incompletos para el Servicio Web, falta el Nombre de la Aplicación"); $Resultado = json_encode($j_array); echo $Resultado; return; } // if($authtoken_ZC == "") // { // $j_array = array('code' => "330", "message" => "ERROR - [wsPreBillZohoBooks] Parametros incompletos para el Servicio Web, falta el Código de Autorización"); // $Resultado = json_encode($j_array); // echo $Resultado; // return; // } if($bDatPac == "") { $j_array = array('code' => "310", "message" => "ERROR - [wsPreBillZohoBooks] Faltan los parametros de conexión OAuth"); $Resultado = json_encode($j_array); echo $Resultado; return; } $bDatPac = base64_decode($bDatPac); $aDatPac = json_decode($bDatPac, true); $RefreshToken = $aDatPac["C_OAuth_refresh_token"]; $ClientId = $aDatPac["C_OAuth_client_id"]; $ClientSecret = $aDatPac["C_OAuth_client_secret"]; $RedirectUri = $aDatPac["C_OAuth_redirect_uri"]; $GrantType = $aDatPac["C_OAuth_grant_type"]; $AuthUrl = "https://accounts.zoho.com/oauth/v2/token"; #Obtenemos el access token de Zoho Creator // $Params = array( // "refresh_token" => $RefreshToken, // "client_id" => $ClientId, // "client_secret" => $ClientSecret, // "redirect_uri" => $RedirectUri, // "grant_type" => $GrantType // ); // $curl = curl_init(); // curl_setopt($curl, CURLOPT_URL, $AuthUrl); // curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); // curl_setopt($curl, CURLOPT_POSTFIELDS, $Params); // curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // $response = curl_exec($curl); // $array = json_decode($response); // $coa_access_token = $array->access_token; $coa_access_token = oauth($appOwner, 'ZCreator', $RefreshToken, $ClientId, $ClientSecret, $RedirectUri, $GrantType, $AuthUrl); #== Conexión a Zoho Creator para obtener el registro de la Orden de Cobro //$request_url = 'https://creator.zoho.com/api/json/'.$app_name_ZC.'/view/Prebills_Query?scope=creatorapi&raw=true&authtoken='.$authtoken_ZC.'&criteria=(ID='.$bRecId.')'; $request_url = 'https://creator.zoho.com/api/v2/'.$appOwner.'/'.$app_name_ZC.'/report/Prebills_Query?criteria=(ID='.$bRecId.')'; $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_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $coa_access_token)); $r = curl_exec($ch); $array = json_decode($r); //$bdDatBill = $array->Prebills; $bdDatBill = $array->data; //print_r($array); //print_r($bdDatBill); #== Datos de la Orden de Cobro $prebill_number = str_pad($bdDatBill[0]->Prebill_Number, 6, "0", STR_PAD_LEFT); $prebill_client = $bdDatBill[0]->Client->display_value; $prebill_matter = $bdDatBill[0]->Matter->display_value; $prebill_date = $bdDatBill[0]->Prebill_Date; $prebill_IncDate = $bdDatBill[0]->Included_to; $prebill_currency = substr($bdDatBill[0]->Currency,0,3); $prebill_Fees = $bdDatBill[0]->Fees; $prebill_Disbur = $bdDatBill[0]->Disbursements; $prebill_SubTot = $bdDatBill[0]->Subtotal_Import; $prebill_ImpIva = $bdDatBill[0]->VAT_Import; $prebill_Import = $bdDatBill[0]->Total_Import; $prebill_PorIva = $bdDatBill[0]->VAT; $prebill_Factur = $bdDatBill[0]->Billable_Hours; $prebill_NoFact = $bdDatBill[0]->NON_Billable_Hours; $prebill_Trabaj = $bdDatBill[0]->Worked_Hours; $prebill_Notes = strip_tags($bdDatBill[0]->Notes); $prebill_TerCon = strip_tags($bdDatBill[0]->Terms_Conditions); $strTotal = number_format($bdDatBill[0]->Total_Import,2,".",""); #== Resumenes para el reporte $prebill_SummPro = json_decode("[".$bdDatBill[0]->Project_Summary."]"); $prebill_SummTks = json_decode("[".$bdDatBill[0]->Timekeeper_Summary."]"); $prebill_SummCha = json_decode("[".$bdDatBill[0]->Charges_Summary."]"); $prebill_domicilio = ""; $prebill_colonia = ""; $prebill_ciudad = ""; $prebill_estado = ""; $prebill_pais = ""; $prebill_codigo = ""; $prebill_attention = ""; foreach ( $bdDatBill[0] as $nombre => $hexa ) { if($nombre == "Client.Domicilio_fiscal") { $prebill_domicilio = $hexa; } if($nombre == "Client.Colonia_fiscal") { $prebill_colonia = $hexa; } if($nombre == "Client.Ciudad_fiscal") { $prebill_ciudad = $hexa; } if($nombre == "Client.Estado_fiscal") { $prebill_estado = $hexa; } if($nombre == "Client.Pais_fiscal") { $prebill_pais = $hexa; } if($nombre == "Client.Codigo_fiscal") { $prebill_codigo = $hexa; } if($nombre == "Client.Atencion_de_facturacion") { $prebill_attention = $hexa; } } $sFecha = substr($prebill_date,0,2)." de "; $sMes = substr($prebill_date,3,3); switch($sMes){ case "Jan": $sFecha = $sFecha . "Enero de "; break; case "Ene": $sFecha = $sFecha . "Enero de "; break; case "Feb": $sFecha = $sFecha . "Febrero de "; break; case "Mar": $sFecha = $sFecha . "Marzo de "; break; case "Apr": $sFecha = $sFecha . "Abril de "; break; case "Abr": $sFecha = $sFecha . "Abril de "; break; case "May": $sFecha = $sFecha . "Mayo de "; break; case "Jun": $sFecha = $sFecha . "Junio de "; break; case "Jul": $sFecha = $sFecha . "Julio de "; break; case "Aug": $sFecha = $sFecha . "Agosto de "; break; case "Ago": $sFecha = $sFecha . "Agosto de "; break; case "Sep": $sFecha = $sFecha . "Septiembre de "; break; case "Oct": $sFecha = $sFecha . "Octubre de "; break; case "Nov": $sFecha = $sFecha . "Noviembre de "; break; case "Dec": $sFecha = $sFecha . "Diciembre de "; break; case "Dic": $sFecha = $sFecha . "Diciembre de "; break; } $sFecha = $sFecha . substr($prebill_date,7,4); #== Conexión a Zoho Creator para obtener los registros de tiempos asociados a la Orden de Cobro //$request_url = 'https://creator.zoho.com/api/json/'.$app_name_ZC.'/view/For_Sincronize_Times?scope=creatorapi&raw=true&authtoken='.$authtoken_ZC.'&criteria=(Prebills='.$bRecId.')'; $request_url = 'https://creator.zoho.com/api/v2/'.$appOwner.'/'.$app_name_ZC.'/report/For_Sincronize_Times?criteria=(Prebills='.$bRecId.')'; $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_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $coa_access_token)); $r = curl_exec($ch); $array = json_decode($r); //$bdDatTime = $array->TimeEntry; $bdDatTime = $array->data; #== Conexión a Zoho Creator para obtener los registros de tiempos asociados a la Orden de Cobro ordenados por fecha // $request_url = 'https://creator.zoho.com/api/json/'.$app_name_ZC.'/view/Times_Order_for_Date?scope=creatorapi&raw=true&authtoken='.$authtoken_ZC.'&criteria=(Prebills='.$bRecId.')'; $request_url = 'https://creator.zoho.com/api/v2/'.$appOwner.'/'.$app_name_ZC.'/report/Times_Order_for_Date?criteria=(Prebills='.$bRecId.')'; $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_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $coa_access_token)); $r = curl_exec($ch); $array = json_decode($r); //$bdTimeOrdered = $array->TimeEntry; $bdTimeOrdered = $array->data; $prebill_prestserv = "Del "; $TotRegsTie = count($bdTimeOrdered); if($TotRegsTie > 0){ # SRL: Modificamos para que cuando el periodo incluya 2 meses imprima: del 03 de junio al 05 de julio de 2021 $sMesInicial = substr($bdTimeOrdered[0]->WorkDate,3,3); $sMesFinal = substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,3,3); if ($sMesInicial==$sMesFinal) { $prebill_prestserv = $prebill_prestserv . substr($bdTimeOrdered[0]->WorkDate,0,2); switch($sMesFinal){ case "Jan": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Enero de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Ene": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Enero de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Feb": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Febrero de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Mar": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Marzo de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Apr": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Abril de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Abr": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Abril de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "May": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Mayo de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Jun": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Junio de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Jul": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Julio de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Aug": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Agosto de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Ago": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Agosto de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Sep": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Septiembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Oct": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Octubre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Nov": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Noviembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Dec": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Diciembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Dic": $prebill_prestserv = $prebill_prestserv . " al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Diciembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; } } else { $prebill_prestserv = $prebill_prestserv . substr($bdTimeOrdered[0]->WorkDate,0,2) . " de "; switch($sMesInicial){ case "Jan": $prebill_prestserv = $prebill_prestserv . "Enero "; break; case "Ene": $prebill_prestserv = $prebill_prestserv . "Enero " ; break; case "Feb": $prebill_prestserv = $prebill_prestserv . "Febrero "; break; case "Mar": $prebill_prestserv = $prebill_prestserv . "Marzo " ; break; case "Apr": $prebill_prestserv = $prebill_prestserv . "Abril "; break; case "Abr": $prebill_prestserv = $prebill_prestserv . "Abril "; break; case "May": $prebill_prestserv = $prebill_prestserv . "Mayo "; break; case "Jun": $prebill_prestserv = $prebill_prestserv . "Junio "; break; case "Jul": $prebill_prestserv = $prebill_prestserv . "Julio "; break; case "Aug": $prebill_prestserv = $prebill_prestserv . "Agosto "; break; case "Ago": $prebill_prestserv = $prebill_prestserv . "Agosto "; break; case "Sep": $prebill_prestserv = $prebill_prestserv . "Septiembre "; break; case "Oct": $prebill_prestserv = $prebill_prestserv . "Octubre "; break; case "Nov": $prebill_prestserv = $prebill_prestserv . "Noviembre "; break; case "Dec": $prebill_prestserv = $prebill_prestserv . "Diciembre "; break; case "Dic": $prebill_prestserv = $prebill_prestserv . "Diciembre "; break; } switch($sMesFinal){ case "Jan": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Enero de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Ene": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Enero de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Feb": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Febrero de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Mar": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Marzo de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Apr": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Abril de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Abr": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Abril de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "May": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Mayo de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Jun": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Junio de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Jul": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Julio de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Aug": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Agosto de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Ago": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Agosto de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Sep": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Septiembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Oct": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Octubre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Nov": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Noviembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Dec": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Diciembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; case "Dic": $prebill_prestserv = $prebill_prestserv . "al " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,0,2) . " de " . "Diciembre de " . substr($bdTimeOrdered[$TotRegsTie - 1]->WorkDate,7,4); break; } } } #== Conexión a Zoho Creator para obtener los registros de gastos asociados a la Orden de Cobro //$request_url = 'https://creator.zoho.com/api/json/'.$app_name_ZC.'/view/Disbursements_Query?scope=creatorapi&raw=true&authtoken='.$authtoken_ZC.'&criteria=(Prebills='.$bRecId.')'; $request_url = 'https://creator.zoho.com/api/v2/'.$appOwner.'/'.$app_name_ZC.'/report/Disbursements_Query?criteria=(Prebills='.$bRecId.')'; $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_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $coa_access_token)); $r = curl_exec($ch); $array = json_decode($r); //$bdDatDisb = $array->Disbursements; $bdDatDisb = $array->data; /* #== Conexión a Zoho Creator para obtener los registros de honorarios fijos asociados a la Orden de Cobro //$request_url = 'https://creator.zoho.com/api/json/'.$app_name_ZC.'/view/Fixed_Fees_Query?scope=creatorapi&raw=true&authtoken='.$authtoken_ZC.'&criteria=(Prebills='.$bRecId.')'; $request_url = 'https://creator.zoho.com/api/v2/'.$appOwner.'/'.$app_name_ZC.'/report/Fixed_Fees_Query?criteria=(Prebills='.$bRecId.')'; $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_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $coa_access_token)); $r = curl_exec($ch); $array = json_decode($r); //$bdDatHonF = $array->Fixed_Fees; $bdDatHonF = $array->data; */ $SendaArchsGraf = "archs_graf/"; $SendaArchsCFDI = "archs_cfdi/"; $NomArchPDF = "OC_SEPLAW_".$prebill_number.".PDF"; $GLOBALS['footOne'] = "Av. Santa Fe 505, P. 3-303, Col. Cruz Manca, Cuajimalpa, Ciudad de México, C.P. 05349"; $GLOBALS['footTwo'] = "www.seplaw.com.mx"; $SendaArchsCFDI = "archs_cfdi/"; $SendaArchsGraf = "archs_graf/"; #============================================================================================================ #== 1. CREAMOS LA CLASE Y OBTENEMOS LOS DATOS BASICOS DEL REPORTE #============================================================================================================ class PDF extends FPDF { function Header() { } function Footer() { if( $this->PageNo() == 1) { $this->SetTextColor(81,81,81); $this->SetFont('arial','',8.5); $this->SetXY(1.0,26.7); $this->MultiCell(19.0, 0.25, utf8_decode($GLOBALS['footOne']), 0, 'C', 0); $this->SetTextColor(81,81,81); $this->SetFont('arial','',8.5); $this->SetXY(1.0,$this->GetY()); $this->Cell(19, 0.25, utf8_decode($GLOBALS['footTwo']), 0, 1,'C', 0); } else { $this->SetTextColor(0,0,0); $this->SetFont('arial','',10); $this->SetXY(19.4,26.9); $this->Cell(1.5, 0.25, $this->PageNo().'/{nb}', 0, 1,'R', 0); } } } #============================================================================================================ #== 2. CONSTRUYENDO EL DOCUMENTOS CON LA LIBRERÍA FPDF #============================================================================================================ $pdf=new PDF('P','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); #============================================================================================================ #== 2.1 ENCABEZADO DE LA FACTURA #============================================================================================================ $X = 0; $Y = 0; $pdf->image("archs_graf/Logo_Prebills_Main.png",$X+5.08, $Y+1 , 11.32, 4.55); $pdf->image("archs_graf/Firma_Seplaw.png",$X+7.15, $Y+16.0 , 7.25, 1.43); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','',8); $pdf->SetXY($X+2,$Y+5.30); $pdf->Cell(3.5, 0.25, utf8_decode("CUENTA DE HONORARIOS Y/O GASTOS"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+15,$Y+6.0); $pdf->Cell(4.0, 0.25, utf8_decode("Ciudad de México, a ".$sFecha), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+7.00); $pdf->Cell(2.5, 0.25, utf8_decode("Cliente:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+4.0,$Y+7.00); $pdf->Cell(4.0, 0.25, utf8_decode($prebill_client), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+4.00,$Y+7.5); //$pdf->MultiCell(14, 0.45, utf8_decode($prebill_domicilio), 0, 'J', 0); $pdf->Cell(14.0, 0.25, utf8_decode($prebill_domicilio), 0, 1,'L', 0); $pdf->SetXY($X+4.00,$Y+7.9); $pdf->Cell(14.0, 0.25, utf8_decode($prebill_colonia)." ".utf8_decode($prebill_ciudad), 0, 1,'L', 0); $pdf->SetXY($X+4.00,$Y+8.3); $pdf->Cell(14.0, 0.25, utf8_decode($prebill_codigo)." ".utf8_decode($prebill_estado), 0, 1,'L', 0); $pdf->SetXY($X+4.00,$Y+8.7); $pdf->Cell(14.0, 0.25, utf8_decode($prebill_pais), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+10.00); $pdf->Cell(2.5, 0.25, utf8_decode("At'n:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+4.0,$Y+10.00); $pdf->Cell(4.0, 0.25, utf8_decode($prebill_attention), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+11.00); $pdf->Cell(2.5, 0.25, utf8_decode("I. Honorarios por servicios profesionales según descripción anexa"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+14,$Y+11.00); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+15.0,$Y+11.00); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+16.0,$Y+11.00); $pdf->Cell(3.0, 0.25, number_format($prebill_Fees,2), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+11.50); $pdf->Cell(2.5, 0.25, utf8_decode("II. Gastos incurridos en relación con los servicios profesionales"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+14,$Y+11.50); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+15.0,$Y+11.50); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+16.0,$Y+11.50); $pdf->Cell(3.0, 0.25, number_format($prebill_Disbur,2), 0, 1,'R', 0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.05); $pdf->line(16.0, 12.0, 19.0, 12.0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+10,$Y+12.250); $pdf->Cell(3.0, 0.25, utf8_decode("Subtotal:"), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+14,$Y+12.250); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+15,$Y+12.250); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+16.0,$Y+12.250); $pdf->Cell(3.0, 0.25, number_format($prebill_SubTot,2), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+10,$Y+13.0); $pdf->Cell(3.0, 0.25, utf8_decode("I.V.A. (".number_format($prebill_PorIva,0)." %)"), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+14,$Y+13.0); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+15,$Y+13.0); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+16.0,$Y+13.0); $pdf->Cell(3.0, 0.25, number_format($prebill_ImpIva,2), 0, 1,'R', 0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.05); $pdf->line(16.0, 13.5, 19.0, 13.5); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+10,$Y+13.75); $pdf->Cell(3.0, 0.25, utf8_decode("Total:"), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+14,$Y+13.75); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+15,$Y+13.75); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+16.0,$Y+13.75); $pdf->Cell(3.0, 0.25, number_format($prebill_Import,2), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+2.0,$Y+15.0); $pdf->MultiCell(17, 0.45, utf8_decode(strtolower(convertirNumeroLetra($strTotal,$prebill_currency) )), 0, 'C', 0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.03); $pdf->line(7.0, 17.5, 15.0, 17.5); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+8,$Y+17.7); $pdf->Cell(1.0, 0.25, utf8_decode("SEPÚLVEDA Y DÍAZ NORIEGA, S.C."), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',9); $pdf->SetXY($X+2,$Y+19.0); $pdf->Cell(1.0, 0.25, utf8_decode("A continuación, encontrará la información correspondiente para el depósito en nuestra cuenta bancaria:"), 0, 1,'L', 0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.03); $pdf->line(2.0, 19.5, 19.0, 19.5); // SRL Julio 01, 2021 // Segun la moneda es la cuenta bancaria // print_r ($prebill_currency); if ($prebill_currency == 'USD') { $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+20.50); $pdf->Cell(1.0, 0.25, utf8_decode("Banco Corresponsal:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+20.50); $pdf->Cell(5.0, 0.25, utf8_decode("JP MORGAN CHASE BANK"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+21.00); $pdf->Cell(1.0, 0.25, utf8_decode("Banco en México:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+21.00); $pdf->Cell(5.0, 0.25, utf8_decode("Banco Santander, (México) S.A."), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+21.50); $pdf->Cell(1.0, 0.25, utf8_decode("Beneficiario:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+21.50); $pdf->Cell(5.0, 0.25, utf8_decode("Sepúlveda y Díaz Noriega, S.C."), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+22.00); $pdf->Cell(1.0, 0.25, utf8_decode("Swift:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+22.00); $pdf->Cell(5.0, 0.25, utf8_decode("BMSXMXMMXXX"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+22.50); $pdf->Cell(1.0, 0.25, utf8_decode("No. de Cuenta:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+22.50); $pdf->Cell(5.0, 0.25, utf8_decode("82-50065878-9"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+23.00); $pdf->Cell(1.0, 0.25, utf8_decode("Clabe Interbancaria:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+23.00); $pdf->Cell(5.0, 0.25, utf8_decode("014180825006587896"), 0, 1,'L', 0); } if ($prebill_currency == "MXN") { $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+20.50); $pdf->Cell(1.0, 0.25, utf8_decode("Banco :"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+20.50); $pdf->Cell(5.0, 0.25, utf8_decode("Banco Santander, S.A."), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+21.00); $pdf->Cell(1.0, 0.25, utf8_decode("Beneficiario:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+21.00); $pdf->Cell(5.0, 0.25, utf8_decode("Sepúlveda y Díaz Noriega, S.C."), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+21.50); $pdf->Cell(1.0, 0.25, utf8_decode("Sucursal:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+21.50); $pdf->Cell(5.0, 0.25, utf8_decode("0398(Diamante Santa Fe)"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+22.00); $pdf->Cell(1.0, 0.25, utf8_decode("No. de Cuenta:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+22.00); $pdf->Cell(5.0, 0.25, utf8_decode("65-50452846-8"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY($X+2,$Y+22.50); $pdf->Cell(1.0, 0.25, utf8_decode("Clabe:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+6.0,$Y+22.50); $pdf->Cell(5.0, 0.25, utf8_decode("014180655045284689"), 0, 1,'L', 0); } $pdf->AddPage(); TitulosPag($pdf); $X = 0; $Y = 0; $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',10); $pdf->SetXY($X+2,$Y+6.50); $pdf->Cell(2.5, 0.25, utf8_decode("Prestados a:"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+4.5,$Y+6.50); $pdf->Cell(4.0, 0.25, utf8_decode($prebill_client), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY($X+4.5,$Y+7.00); $pdf->Cell(4.0, 0.25, utf8_decode($prebill_matter), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',10); $pdf->SetXY($X+2,$Y+7.75); //SRL $pdf->Cell(2.5, 0.25, utf8_decode("Periodo de la Prestación de Servicios: ".strtolower($prebill_prestserv)), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',10); $pdf->SetXY($X+2,$Y+8.50); $pdf->Cell(2.5, 0.25, utf8_decode("Descripción de los Servicios:"), 0, 1,'L', 0); TitulosTie($pdf,8.0); $X = 0; $Y = 10.0; #============================================================================================================ #== 2.2 REGISTROS DE TIEMPOS #============================================================================================================ $Puntero = $pdf->GetY(); $TotRegsTie = count($bdDatTime); if($TotRegsTie > 0){ $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $Puntero = $Y; for ($i = 0; $i < $TotRegsTie; $i++){ if ($Puntero > 24.5) { $pdf->AddPage(); TitulosPag($pdf); TitulosTie($pdf,5.0); $Y = 7.0; } $time_timekeeper = ""; foreach ( $bdDatTime[$i] as $nombre => $hexa ) { if($nombre == "Timekeeper.Identity") { $time_timekeeper = $hexa; } } //srl $sMesWork = substr($bdDatTime[$i]->WorkDate,3,3); switch($sMesWork){ case "Jan": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/01/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Ene": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/01/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Feb": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/02/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Mar": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/03/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Apr": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/04/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Abr": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/04/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "May": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/05/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Jun": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/06/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Jul": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/07/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Aug": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/08/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Ago": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/08/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Sep": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/09/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Oct": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/10/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Nov": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/11/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Dec": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/12/".substr($bdDatTime[$i]->WorkDate,9,2); break; case "Dic": $sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/12/".substr($bdDatTime[$i]->WorkDate,9,2); break; } //$sDateWork = strtolower(substr($bdDatTime[$i]->WorkDate,0,2)."/".substr($bdDatTime[$i]->WorkDate,3,3)."/".substr($bdDatTime[$i]->WorkDate,9,2)); //$sDateWork = substr($bdDatTime[$i]->WorkDate,0,2)."/".substr($bdDatTime[$i]->WorkDate,3,3)."/".substr($bdDatTime[$i]->WorkDate,9,2); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',9); $pdf->SetXY(2.0,$Y); $pdf->Cell(3.5, 0.25, utf8_decode($sDateWork), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',9); $pdf->SetXY(3.9,$Y); $pdf->Cell(1.3, 0.25, utf8_decode($time_timekeeper), 0, 1,'C', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',9); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.0, 0.25, number_format($bdDatTime[$i]->dHours,2), 0, 1,'C', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',9); $pdf->SetXY(5.5,$Y); $pdf->MultiCell(11.5, 0.30, utf8_decode(trim($bdDatTime[$i]->Description)), 0, 'J', 0); $YY = $pdf->GetY()+0.50; $Puntero = $pdf->GetY(); $Y = $YY; } $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y-0.1, 19.0, $Y-0.1); $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(3.5, 0.25, "Total Trabajos", 0, 1,'L', 0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.0, 0.25, number_format($prebill_Factur,2), 0, 1,'C', 0); $Puntero = $pdf->GetY(); } if ($Puntero > 24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 5.0; } $Y = $Y + 1.0; #============================================================================================================ #== 2.2 RESUMEN DE HONORARIOS #============================================================================================================ $pdf->SetFont('arial','B',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(18, 0.25, "RESUMEN DE HONORARIOS", 0, 1,'C', 0); $X = $X; $Y = $Y+0.5; $Puntero = $Y; if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 5.0; } $TotRegsTie = count($prebill_SummTks); if($TotRegsTie > 0){ $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(6.35, 0.60, utf8_decode("Abogado SEPLAW"), 0, 1,'L', 0); $pdf->SetXY(10.5,$Y); $pdf->SetTextColor(0,0,0); $pdf->Cell(3.5, 0.60, utf8_decode("Costo por Hr."), 0, 1,'L', 0); $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(13.80,$Y); $pdf->Cell(2.00, 0.60, utf8_decode("Hrs Trabajadas"), 0, 1,'R', 0); $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.50, 0.60, utf8_decode("Total de Honorarios"), 0, 1,'R', 0); $Y = $Y+0.7; $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y-0.2, 19.50, $Y-0.2); for ($i = 0; $i < $TotRegsTie; $i++){ $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); if($prebill_SummTks[$i]->TotImp > 0) { $pdf->SetXY(2.00,$Y); $pdf->Cell(6.25, 0.30, utf8_decode($prebill_SummTks[$i]->Name), 0, 1,'L', 0); $pdf->SetFont('arial','B',9); $pdf->SetXY(8.2,$Y); $pdf->Cell(3.5, 0.30, utf8_decode("[".$prebill_SummTks[$i]->Clave."]"), 0, 1,'L', 0); $pdf->SetFont('arial','B',9); $pdf->SetXY(10.00, $Y); $pdf->Cell(3.5, 0.30, utf8_decode($prebill_currency." $"), 0, 1,'L', 0); $pdf->SetFont('arial','B',10); $pdf->SetXY(10.70,$Y); $pdf->Cell(2.00, 0.30, number_format($prebill_SummTks[$i]->Rate,2), 0, 1,'R', 0); $pdf->SetFont('arial','B',10); $pdf->SetXY(13.8,$Y); $pdf->Cell(2.00, 0.30, number_format($prebill_SummTks[$i]->TotHrs,2), 0, 1,'R', 0); $pdf->SetFont('arial','B',9); $pdf->SetXY(16.20,$Y); $pdf->Cell(3.5, 0.30, utf8_decode($prebill_currency." $"), 0, 1,'L', 0); $pdf->SetFont('arial','B',10); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.50, 0.30, number_format($prebill_SummTks[$i]->TotImp,2), 0, 1,'R', 0); //$pdf->SetDrawColor(140,133,169); //$pdf->line(1.0, $Y-0.1, 20.45, $Y-0.1); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>25.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 5.0; } } } $Y = $pdf->GetY()+0.50; $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',12); $pdf->SetXY(2.0,$Y); $pdf->Cell(10.0, 0.60, "Suma Total de Honorarios: " . utf8_decode($prebill_currency) . " $ " . number_format($prebill_Fees,2), 0, 1,'L', 0); } if ($Puntero > 24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 5.0; } $Y = $Y + 2.0; #============================================================================================================ #== 2.2 DETALLE DE GASTOS #============================================================================================================ if($TotRegsGas > 0) { $pdf->SetFont('arial','B',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(18, 0.25, "GASTOS", 0, 1,'C', 0); $X = $X; $Y = $Y+0.5; $Puntero = $Y; if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } } $TotRegsGas = count($bdDatDisb); if($TotRegsGas > 0){ $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; $pdf->SetFont('arial','B',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(2.00, 0.60, utf8_decode("Fecha"), 0, 1,'L', 0); $pdf->SetXY(5.0,$Y); $pdf->SetTextColor(0,0,0); $pdf->Cell(10.0, 0.60, utf8_decode("Descripción"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetXY(16.00,$Y); $pdf->Cell(3.00, 0.60, utf8_decode("Monto (".$prebill_currency.")"), 0, 1,'R', 0); $Y = $Y+0.7; $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y-0.2, 19.50, $Y-0.2); for ($i = 0; $i < $TotRegsGas; $i++){ $sDateWork = strtolower(substr($bdDatDisb[$i]->WorkDate,0,2)."/".substr($bdDatDisb[$i]->WorkDate,3,3)."/".substr($bdDatDisb[$i]->WorkDate,9,2)); $pdf->SetFont('verdana','',10); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(2.10,$Y); $pdf->Cell(2.0, 0.30, utf8_decode($sDateWork), 0, 1,'L', 0); $pdf->SetFont('verdana','',9); $pdf->SetXY(16.20,$Y); $pdf->Cell(1.5, 0.30, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetFont('verdana','',10); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.45, 0.30, number_format($bdDatDisb[$i]->Import,2), 0, 1,'R', 0); $pdf->SetFont('verdana','',10); $pdf->SetXY(5.0,$Y); $pdf->MultiCell(10.0, 0.30, utf8_decode(trim($bdDatDisb[$i]->Description)), 0, 'J', 0); $YY = $pdf->GetY()+0.20; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } } $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y, 19.50, $Y); $Y = $Y + 0.20; $pdf->SetFont('arial','B',10); $pdf->SetXY(16.20,$Y); $pdf->Cell(1.5, 0.30, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetXY(17.0,$Y); $pdf->Cell(2.45, 0.30, number_format($prebill_Disbur,2), 0, 1,'R', 0); $Y = $Y + 1.0; } if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } /* SRL 2021/02/12 Se quita la seccion de resumen de gastos por solicitud de cliente #============================================================================================================ #== 2.2 RESUMEN DE GASTOS #============================================================================================================ $pdf->SetFont('arial','B',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(18, 0.25, "RESUMEN DE GASTOS", 0, 1,'C', 0); $X = $X; //SRL De 0.5 a 1.0 $Y = $Y+1.0; $Puntero = $Y; //SRL 2021/02/04 Agregar linea $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y-0.2, 19.50, $Y-0.2); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 5.0; } $TotRegsTie = count($prebill_SummCha); if($TotRegsTie > 0){ $Regs = 0; $Y = $pdf->GetY()+0.20; $Y = $Y+0.5; for ($i = 0; $i < $TotRegsTie; $i++){ $pdf->SetFont('verdana','',10); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',9); $pdf->SetXY(16.20,$Y); $pdf->Cell(1.5, 0.30, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetFont('verdana','',10); $pdf->SetXY(17.00,$Y); $pdf->Cell(2.45, 0.30, number_format($prebill_SummCha[$i]->TotDis,2), 0, 1,'R', 0); $pdf->SetFont('verdana','',10); $pdf->SetXY(2.10,$Y); $pdf->MultiCell(14.0, 0.30, utf8_decode($prebill_SummCha[$i]->Name), 0, 'L', 0); $YY = $pdf->GetY()+0.18; $Puntero = $pdf->GetY(); $Y = $YY; $Regs++; if ($Puntero>25.5) { $pdf->AddPage(); TitulosPag($pdf); } } //SRL Agregar linea $Y = $Y+0.5; $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y-0.2, 19.50, $Y-0.2); $Y = $pdf->GetY()+0.50; $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',12); $pdf->SetXY(2.0,$Y); $pdf->Cell(10.0, 0.60, "Suma Total de Gastos: " . utf8_decode($prebill_currency) . " $ " . number_format($prebill_Disbur,2), 0, 1,'L', 0); $Y = $Y + 1.0; } $Y = $Y + 1.0; $Puntero = $pdf->GetY(); // SRL De 23.5 a 24.5 if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 5.0; } */ #============================================================================================================ #== 2.2 TOTALES GENERALES #============================================================================================================ /* $pdf->SetFont('arial','B',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(18, 0.25, "GRAN TOTAL:", 0, 1,'L', 0); */ $Y = $Y + 1.0; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetFont('arial','B',12); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(18, 0.25, "GRAN TOTAL:", 0, 1,'L', 0); $Y = $Y + 1.0; $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(2.0,$Y); $pdf->Cell(5.5, 0.25, utf8_decode("I. Honorarios por servicios profesionales según descripción anexa"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(14,$Y); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(15.0,$Y); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(16.0,$Y); $pdf->Cell(3.0, 0.25, number_format($prebill_Fees,2), 0, 1,'R', 0); $Y = $Y + 0.50; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(2,$Y); $pdf->Cell(2.5, 0.25, utf8_decode("II. Gastos incurridos en relación con los servicios profesionales"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(14,$Y); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(15.0,$Y); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(16.0,$Y); $pdf->Cell(3.0, 0.25, number_format($prebill_Disbur,2), 0, 1,'R', 0); $Y = $Y + 0.50; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.05); $pdf->line(16.0, $Y, 19.0, $Y); $Y = $Y + 0.25; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(10,$Y); $pdf->Cell(3.0, 0.25, utf8_decode("Subtotal:"), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(14,$Y); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(15,$Y); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(16.0,$Y); $pdf->Cell(3.0, 0.25, number_format($prebill_SubTot,2), 0, 1,'R', 0); $Y = $Y + 0.50; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(10,$Y); $pdf->Cell(3.0, 0.25, utf8_decode("I.V.A. (".number_format($prebill_PorIva,0)." %)"), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(14,$Y); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(15,$Y); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('verdana','',10); $pdf->SetXY(16.0,$Y); $pdf->Cell(3.0, 0.25, number_format($prebill_ImpIva,2), 0, 1,'R', 0); $Y = $Y + 0.50; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.05); $pdf->line(16.0, $Y, 19.0, $Y); $Y = $Y + 0.25; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(10,$Y); $pdf->Cell(3.0, 0.25, utf8_decode("Total:"), 0, 1,'R', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(14,$Y); $pdf->Cell(1.0, 0.25, utf8_decode($prebill_currency), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(15,$Y); $pdf->Cell(1.0, 0.25, utf8_decode("$"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(16.0,$Y); $pdf->Cell(3.0, 0.25, number_format($prebill_Import,2), 0, 1,'R', 0); $Y = $Y + 1.00; $Puntero = $pdf->GetY(); if ($Puntero>24.5) { $pdf->AddPage(); TitulosPag($pdf); $Y = 6.0; } $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',11); $pdf->SetXY(2.0,$Y); $pdf->MultiCell(17, 0.45, utf8_decode(strtolower(convertirNumeroLetra($strTotal,$prebill_currency) )), 0, 'C', 0); $Y = $pdf->GetY()+0.50; $pdf->SetFont('verdana','',10); $pdf->SetTextColor(0,0,0); $pdf->SetXY(2.0,$Y); $pdf->Cell(19, 0.25, "-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.", 0, 1,'C', 0); #============================================================================================================ #== 2.6 SE GRABA EL DOCUMENTO .PDF EN EL DISCO DURO #============================================================================================================ $pdf->Output($SendaArchsCFDI.$NomArchPDF, 'F'); #============================================================================================================ #== 2.7 DESCOMENTAR SI ESTÁ UTILIZANDO EL SISTEMA OPERATIVO LINUX. #============================================================================================================ chmod ($SendaArchsCFDI.$NomArchPDF,0777); #============================================================================================================ #== 2.8 SE MUESTRA EL DOCUMENTO .PDF EN EL NAVEGADOR. #============================================================================================================ //$pdf->Output($SendaArchsCFDI.$NomArchPDF, 'I'); #============================================================================================================ # 2.9 Envio del Archivos a Zoho Creator #============================================================================================================ if($organi_id_ZB == "" && $invoiceID == "") { $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/'.$appOwner.'/'.$app_name_ZC.'/report/Prebills_Report/' . $bRecId . '/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' => $app_name_ZC, // 'formname' => 'Prebills', // 'fieldname' => 'File_PDF_OC', // 'recordId' => $bRecId, // '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 ' . $coa_access_token)); $r = curl_exec($ch); curl_close ($ch); } #============================================================================================================ # 2.10 Envio del Archivos a Zoho Books #============================================================================================================ if($organi_id_ZB <> "" && $invoiceID <> "") { # 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"; // $bParams = array( // "refresh_token" => $bRefreshToken, // "client_id" => $bClientId, // "client_secret" => $bClientSecret, // "redirect_uri" => $bRedirectUri, // "grant_type" => $bGrantType // ); // $curl = curl_init(); // curl_setopt($curl, CURLOPT_URL, $bAuthUrl); // curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST'); // curl_setopt($curl, CURLOPT_POSTFIELDS, $bParams); // curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // $response = curl_exec($curl); // $array = json_decode($response); // $boa_access_token = $array->access_token; $boa_access_token = oauth('Seplaw', 'ZBooks', $bRefreshToken, $bClientId, $bClientSecret, $bRedirectUri, $bGrantType, $bAuthUrl); //$boa_access_token = oauth($appOwner, 'ZBooks', $bRefreshToken, $bClientId, $bClientSecret, $bRedirectUri, $bGrantType, $bAuthUrl); $file_name_with_full_path = '/var/www/html/aptusCFDIRF/archs_cfdi/'.$NomArchPDF; $request_url = 'https://www.zohoapis.com/books/v3/invoices/'.$invoiceID.'/attachment'; echo 'request url: ' . $request_url; echo '
at: ' . $boa_access_token; 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' => $organi_id_ZB, // '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_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 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"); $Resultado = json_encode($j_array); echo $Resultado; return; #============================================================================================================ #== FUNCIONES GENERALES #============================================================================================================ function TitulosPag($pdf){ $pdf->image("archs_graf/Logo_Prebills_Second.png",9.0, 1 , 11.32, 4.55); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','',8); $pdf->SetXY(2,5.30); $pdf->Cell(3.5, 0.25, utf8_decode("RELACIÓN DE SERVICIOS"), 0, 1,'L', 0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.03); $pdf->line(2.0, 5.6, 19.0, 5.6); } function TitulosTie($pdf, $Y){ $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',9); $pdf->SetXY(17.5,$Y+1.00); $pdf->Cell(3.5, 0.25, utf8_decode("Horas"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',9); $pdf->SetXY(2.0,$Y+1.50); $pdf->Cell(3.5, 0.25, utf8_decode("Fecha"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',9); $pdf->SetXY(3.5,$Y+1.50); $pdf->Cell(3.5, 0.25, utf8_decode("Profesional"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',9); $pdf->SetXY(10.0,$Y+1.50); $pdf->Cell(3.5, 0.25, utf8_decode("Descripción"), 0, 1,'L', 0); $pdf->SetTextColor(0,0,0); $pdf->SetFont('arial','B',9); $pdf->SetXY(17.0,$Y+1.50); $pdf->Cell(3.5, 0.25, utf8_decode("Trabajadas"), 0, 1,'L', 0); $pdf->SetDrawColor(0,0,0); $pdf->SetLineWidth(0.02); $pdf->line(2.0, $Y+1.80, 19.0, $Y+1.80); } function TitulosGas($pdf, $Y ){ $Y = $Y + 0.24; $pdf->SetFont('arial','',10); $pdf->SetXY(1.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->Cell(12.5, 0.60, "", 0, 1,'L', 1); $pdf->SetTextColor(255,255,255); $pdf->SetXY(1.25,$Y); $pdf->Cell(12.5, 0.60, utf8_decode($lblAboFec), 0, 1,'L', 1); $pdf->SetFont('arial','',10); $pdf->SetXY(13.5,$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(15.5,$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(18.0,$Y); $pdf->SetFillColor(60,61,58); $pdf->SetTextColor(255,255,255); $pdf->Cell(2.45, 0.60, $lblImport, 0, 1,'R', 1); }