* Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file cfdimx/cfdimxindex.php * \ingroup cfdimx * \brief Home page of cfdimx top menu */ // Load Dolibarr environment $res = 0; // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; } // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } // Try main.inc.php using relative path if (!$res && file_exists("../main.inc.php")) { $res = @include "../main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res && file_exists("../../../main.inc.php")) { $res = @include "../../../main.inc.php"; } if (!$res) { die("Include of main fails"); } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; dol_include_once('/cfdimx/class/facture.class.php'); dol_include_once('/cfdimx/class/societe.class.php'); // Load translation files required by the page $langs->loadLangs(array("cfdimx@cfdimx")); $action = GETPOST('action', 'aZ09'); $max = 5; $now = dol_now(); // Security check - Protection if external user $socid = GETPOST('socid', 'int'); if (isset($user->socid) && $user->socid > 0) { $action = ''; $socid = $user->socid; } /* * Actions */ // None /* * View */ $form = new Form($db); $formfile = new FormFile($db); $facture_cfdi = new FactureCFDI($db); llxHeader("", $langs->trans("Inicio - CFDIMX")); print load_fiche_titre($langs->trans("Inicio - CFDIMX"), '', 'bill'); // $url = "http://216.238.75.81:8080/TestJersey/api/servicio/contab/reporte_auxiliares/2024/-1/null/null/null/null/null"; // $info_timbrado = getURLContent($url, 'GET', '', 1, array(), array('http', 'https'), 2); // $data = json_decode($info_timbrado['content']); // $tabla = array(); // $i = 0; // foreach ($data as $key => $value) { // if($i == 17){ // break; // } // $separa_descta = explode("-", $value->descta); // $agrupador = $separa_descta[0]."".$separa_descta[1]."".$separa_descta[2]."".$separa_descta[3]; // $nivel = 4; // $btn = 1; // if($separa_descta[1] == 0 && $separa_descta[2] == 0 && $separa_descta[3] == 0){ // $nivel = 1; // }elseif($separa_descta[2] == 0 && $separa_descta[3] == 0){ // $nivel = 2; // }elseif($separa_descta[3] == 0){ // $nivel = 3; // $btn = 0; // } // switch ($nivel) { // case 2: // $agrupador = $separa_descta[0]."000"; // break; // case 3: // $agrupador = $separa_descta[0]."".$separa_descta[1]."00"; // break; // case 4: // $agrupador = $separa_descta[0]."".$separa_descta[1]."".$separa_descta[2]."0"; // break; // default: // // code... // break; // } // // print '
';
// 	// 	print_r($separa_descta);
// 	// print '
'; // // print 'nivel::'.$nivel.':
'; // $tabla[] = array( // "cta" => $value->cta, // "descta" => $value->descta, // "nivel" => $nivel, // "clase" => $key, // "agrupador" => $agrupador, // "btn" => $btn // ); // $i++; // } // $sql = "SELECT * FROM ".MAIN_DB_PREFIX."c_xmlfclientes_ctas"; // $sql .= " ORDER BY rowid ASC"; // $resql = $db->query($sql); // if($resql){ // $num = $db->num_rows($resql); // $i = 0; // while ($i < $num) { // $obj = $db->fetch_object($resql); // $nivel = 4; // $cta = $obj->cta."-".$obj->scta."-".$obj->sscta."-".$obj->ssscta; // $cta_agrupadora = $obj->cta.".".$obj->scta.".".$obj->sscta.".".$obj->ssscta; // if($obj->scta == 0 && $obj->sscta == 0 && $obj->ssscta == 0){ // $nivel = 1; // $cta_agrupadora = $obj->cta.'.0.0.0'; // }elseif($obj->sscta == 0 && $obj->ssscta == 0){ // $nivel = 2; // $cta_agrupadora = $obj->cta.'.0.0.0'; // }elseif($obj->ssscta == 0){ // $nivel = 3; // $cta_agrupadora = $obj->cta.".".$obj->scta.'.0.0'; // } // // print $cta.','.$obj->descripcion.','.$nivel.',D,1,'.$obj->cuenta_agrupadora.','.$obj->agrupar.'
'; // // print 'cta::'.$obj->cta.'::desc'.$obj->descripcion.'::nivel'.$nivel.'
'; // // print '
nivel:.'.$nivel.'<-->cta agrupadora::'.$cta_agrupadora.'
'; // // print_r($obj); // // print '
'; // // print '
'; // // $sql_tmp = "UPDATE ".MAIN_DB_PREFIX."c_xmlfclientes_ctas"; // // $sql_tmp .= " SET"; // // $sql_tmp .= " nivel = ".$nivel.","; // // $sql_tmp .= " cuenta_agrupadora = '".$cta_agrupadora."'"; // // $sql_tmp .= " WHERE"; // // $sql_tmp .= " rowid = ".$obj->rowid; // // $db->query($sql_tmp); // $i++; // } // } // $lista_usuarios = array(); // // Inicia nuevo proceso para envio de correos Relacion Usuario - Cliente // $sql = "SELECT us.fk_user, u.email FROM ".MAIN_DB_PREFIX."stocksociete_user_societe AS us"; // $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user AS u ON u.rowid = us.fk_user"; // $sql .= " WHERE"; // $sql .= " us.entity = ".$conf->entity; // $sql .= " AND us.fk_soc = ".$obj->fk_soc; // $resql = $db->query($sql); // print $sql; // if($resql){ // $i = 0; // $num = $db->num_rows($resql); // while($i < $num){ // $obj = $db->fetch_object($resql); // if(!is_nul($obj->email) && $obj->email != ""){ // $lista_destinatarios[] = $obj->email; // if(!in_array($obj->fk_user, $lista_usuarios)){ // $lista_usuarios[] = $obj->fk_user; // } // } // $i++; // } // } // $id_pedido = sprintf("%'.013d\n", 10); // $id_pedido = 10; // $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode('phpbarcode').'&code='.urlencode($id_pedido).'&encoding='.urlencode('EAN13'); //print $url; // print ''; // echo sprintf("%'.015d\n", 1000001045603); print '
'; // Draft MyObject $notimbradas = $facture_cfdi->getFacturas(1, $conf->global->CFDIMX_NUM_LIST_FAC_TIM_HOME); // print 'notimbradas::'.$notimbradas.'::'; // print '
';
// 	print_r($facture_cfdi->list_facturas);
// print '
'; print ''; print ''; print ''; print ''; if($notimbradas > 0){ $total = 0; foreach ($facture_cfdi->list_facturas as $key => $value) { // print '
';
			// 	print_r($value);
			// print '
'; $facture_static = new FactureCFDI($db); $facture_static->fetch($value["facture"]); $societe_static = new SocieteCFDIMX($db); $societe_static->fetch($facture_static->socid); print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; $total += $facture_static->total_ttc; } if($total > 0){ print ''; print ''; print ''; print ''; print ''; } }else{ print ''; print ''; print ''; } print "
Últimas '.$conf->global->CFDIMX_NUM_LIST_FAC_TIM_HOME.' Facturas Timbradas
'.$facture_static->getNomUrl(1).''.dol_print_date($facture_static->date, 'day').''.$societe_static->getNomUrl(1).''.price($facture_static->total_ttc).''; print $value["uuid"]; print ''.$facture_static->array_options["options_usocfdi"].'
'.$langs->trans("Total").''.price($total).' 
Sin Facturas por Mostrar

"; //
print '
'; // print '
'; $timbradas = $facture_cfdi->getFacturas(2, $conf->global->CFDIMX_NUM_LIST_FAC_NOTIM_HOME); // print 'notimbradas::'.$notimbradas.'::'; // print '
';
// 	print_r($facture_cfdi->list_facturas);
// print '
'; print ''; print ''; print ''; print ''; if($timbradas > 0){ $total = 0; foreach ($facture_cfdi->list_facturas as $key => $value) { // print '
';
			// 	print_r($value);
			// print '
'; $facture_static = new FactureCFDI($db); $facture_static->fetch($value["facture"]); $societe_static = new SocieteCFDIMX($db); $societe_static->fetch($facture_static->socid); print ''; print ''; print ''; print ''; print ''; print ''; $total += $facture_static->total_ttc; } if($total > 0){ print ''; print ''; print ''; print ''; } }else{ print ''; print ''; print ''; } print "
Últimas '.$conf->global->CFDIMX_NUM_LIST_FAC_NOTIM_HOME.' Facturas sin Timbrar
'.$facture_static->getNomUrl(1).''.dol_print_date($facture_static->date, 'day').''.$societe_static->getNomUrl(1).''.price($facture_static->total_ttc).'
'.$langs->trans("Total").''.price($total).'
Sin Facturas por Mostrar

"; print '
'; // End of page llxFooter(); $db->close();