'; // print_r($parameters); // print ''; // print 'addMoreActionsButtons'; if (in_array('invoicecard', explode(':', $parameters['context']))) { if ($object->statut == 1 || $object->statut == 2) { $url = $dolibarr_main_url_root.$dolibarr_main_url_root_alt . '/cfdimx/facture/card.php?facid=' . $object->id; #Se valida si la factura esta dentro del rango de 72 horas $sql = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'facture WHERE rowid = ' . $object->id . ' AND datef > NOW() - INTERVAL 72 HOUR'; $resql = $db->query($sql); if ($resql) { if ($db->num_rows($resql) > 0) { #Se valida si ya fue timbrada $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'cfdimx WHERE fk_facture='.$object->id; $resql = $db->query($sql); if ($db->num_rows($resql) <= 0) { // $aux = 'CFDI'; // print $aux; print ''; print 'CFDI'; print ''; } } } } } } function formConfirm($parameters, &$object, &$action, $hookmanager){ if (in_array('paiementcard', explode(':', $parameters['context']))) { global $langs, $conf, $db; $moneda_sel = (GETPOST('moneda_cfdimx') != '' ? GETPOST('moneda_cfdimx') : $conf->currency); $complemento = new ComplementoPagos($db); $langs->load('cfdimx@cfdimx'); $list_monedas = ''; $list_monedas .= '
'; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= ''; $list_monedas .= '
'; $list_monedas .= $langs->trans("CurrencyCP"); $list_monedas .= ''; $list_monedas .= $complemento->obtener_moneda($moneda_sel, 'moneda_cfdimx', 1); $list_monedas .= '  '; $list_monedas .= ''; $list_monedas .= '
'; $list_monedas .= ''; $list_monedas .= '  '; $list_monedas .= 'Información requerida para CFDI'; $list_monedas .= '
'; $list_monedas .= '
'; $list_monedas .= '
'; print $list_monedas; } } /** * Overloading the formObjectOptions function : replacing the parent's function with the one below * * @param array() $parameters Hook metadatas (context, etc...) * @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) * @param string &$action Current action (if set). Generally create or edit or null * @param HookManager $hookmanager Hook manager propagated to allow calling another hook * @return int < 0 on error, 0 on success, 1 to replace standard code */ function formObjectOptions($parameters, &$object, &$action, $hookmanager) { global $dolibarr_main_data_root; if (in_array('invoicecard', explode(':', $parameters['context']))) { $posicion = strpos($_SERVER["PHP_SELF"], 'cfdimx'); $confirm = GETPOST('confirm', 'alpha'); if ($posicion == false) { global $db, $conf, $user; $dol_version = (int)DOL_VERSION; /*print 'action :: '.$action; $evento_agenda = new ActionComm($db); $now=dol_now(); $evento_agenda->elementtype = "cfdimx"; $evento_agenda->type_code = "AC_OTH_AUTO"; $evento_agenda->type_id = "20"; $evento_agenda->code = "AC_OTH_AUTO"; $evento_agenda->socid = "1"; $evento_agenda->percentage = 100; $evento_agenda->label = "Cambio de Tercero ZZZ"; $evento_agenda->note = "Se Cambio el Tercero ZZZ"; $evento_agenda->fk_element = $_REQUEST["facid"]; $evento_agenda->userownerid = $user->id; $evento_agenda->datep = $db->idate($now); $aux = $evento_agenda->create($user,1);*/ if($action != 'create'){ print ''; print ''; print ''; print ''; print ''; print ''; print ''; print '
Cambiar Tercero'; print ''; if($dol_version >= 12){ print ''; }else{ print ' '; } print '
'; print ''; if(GETPOST('action') == 'edit_tercero'){ $form = new Form($db); print ''; $form->form_thirdparty($_SERVER['PHP_SELF'] . '?facid=' . $object->id.'&action=guarda_tercero', $object->socid, 'socid'); print ''; }else{ if(GETPOST('action') == 'guarda_tercero'){ $tercero_old = new Societe($db); $tercero_old->fetch($object->socid); $nombre_tercero_old = $object->socid."::".$tercero_old->nom; $tercero_new = new Societe($db); $tercero_new->fetch($_REQUEST["socid"]); $nombre_tercero_new = $_REQUEST["socid"]."::".$tercero_new->nom; $cambia_tercero = "UPDATE " . MAIN_DB_PREFIX . "facture SET fk_soc = ".$_REQUEST["socid"]." WHERE rowid = " . $_REQUEST["facid"]; $res_cambia_tercero = $db->query($cambia_tercero); $evento_agenda = new ActionComm($db); $now=dol_now(); $evento_agenda->elementtype = "invoice"; $evento_agenda->type_code = "AC_OTH_AUTO"; $evento_agenda->type_id = "20"; $evento_agenda->code = "AC_OTH_AUTO"; $evento_agenda->socid = $_REQUEST["socid"]; $evento_agenda->percentage = 100; $evento_agenda->label = "Cambio de Tercero"; $evento_agenda->note = "Se Cambio el Tercero ".$nombre_tercero_old." por el Tercero ".$nombre_tercero_new; $evento_agenda->fk_element = $_REQUEST["facid"]; $evento_agenda->userownerid = $user->id; $evento_agenda->datep = $db->idate($now); $aux = $evento_agenda->create($user,1); print ''; }else{ $tercero_sel = new Societe($db); $tercero_sel->fetch($object->socid); print ''; print '  ' . $tercero_sel->getNomUrl(1, 'compta'); print ''; } } print ''; } if ($object->statut > 0) { $url = DOL_URL_ROOT . '/cfdimx/facture.php?facid=' . $object->id; $sql = "SELECT * FROM " . MAIN_DB_PREFIX . "cfdimx WHERE fk_facture = " . $object->id; $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; if ($num) { while ($i < $num) { $obj = $db->fetch_object($resql); if ($obj) { print ''; print ''; print ''; print ' '; print 'Información Fiscal'; print ''; print ''; $sql = 'SELECT IFNULL(tipo_document,NULL) as tipo_document FROM ' . MAIN_DB_PREFIX . 'cfdimx_type_document WHERE fk_facture=' . $object->id; $resp = $db->query($sql); $respp = $db->fetch_object($resp); print ''; print ''; print 'Tipo de documento'; print ''; print ''; if ($respp->tipo_document != NULL) { if ($respp->tipo_document == 1) { print "Factura Estándar"; } if ($respp->tipo_document == 2) { print "Recibo de Honorarios"; } if ($respp->tipo_document == 3) { print "Recibo de Arrendamiento"; } if ($respp->tipo_document == 4) { print "Nota de Crédito"; } if ($respp->tipo_document == 5) { print "Factura de Fletes"; } if ($respp->tipo_document == 7) { print "Factura de Traslado"; } if ($respp->tipo_document == 8) { print "Factura Global"; } if ($respp->tipo_document == 9) { print 'Factura CCE (Comercio Exterior)'; } }else { $sql = 'SELECT type FROM '.MAIN_DB_PREFIX.'facture WHERE rowid=' . $object->id; $resp = $db->query($sql); $respp = $db->fetch_object($resp); if ($respp->type == 2) { print "Nota de Crédito"; } else { print "Factura Estándar"; } } print ''; print ''; print ''; $ruta = $object->ref.'/'.$obj->uuid.'.png'; $societe_cfdi = new SocieteCFDIMX($db); $societe_cfdi->getDatosXML($object->ref, $obj->uuid); $titulo = "Consultar el Estatus de la Factura (".$obj->uuid.") en el Portal del SAT."; $url_sat = 'https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?id='.$obj->uuid.'&re='.$societe_cfdi->datos_xml["emisor_rfc"].'&rr='.$societe_cfdi->datos_xml["receptor_rfc"].'&tt='.$object->total_ttc.'&fe='.substr($obj->selloCFD,-8); print ''; print 'Códgio QR'; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print 'Fecha y Hora de Timbrado'; print ''; print $obj->fecha_timbrado . ' ' . $obj->hora_timbrado; print ''; print ''; } $i++; } } } } } } } // Archivo Actions del módulo function ActionButtons($parameters, &$object, &$action, $hookmanager) { // if (in_array('takeposfrontend', explode(':', $parameters['context']))) { // global $db, $conf, $user, $menus, $langs; // $menus = null; // $r = 0; // if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { // $menus[$r++] = array('title'=>'
'.$langs->trans("New").'
', 'action'=>'New();'); // } // if ( ! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { // $menus[$r++] = array('title'=>'
'.$langs->trans("History").'
', 'action'=>'History();'); // } // $menus[$r++] = array('title'=>'
'.$langs->trans("Payment").'
', 'action'=>'CloseBill();'); // print ''; // } } // function completeTakePosInvoiceHeader($parameters, &$object, &$action, $hookmanager) { // // print 'takeposinvoice::'; // // print '
';  
        //     //     print_r($parameters);
        //     // print '
'; // if (in_array('takeposinvoice', explode(':', $parameters['context']))) { // if($object->id > 0){ // $div = '
'; // $div .= "Folio: ".$object->array_options["options_foliovima"]; // $div .= '
'; // $hookmanager->resPrint = $div; // } // } // } // function completePayment($parameters, &$object, &$action, $hookmanager) { // global $db; // // print '
';
        //     //     print_r($parameters);
        //     // print '
'; // if (in_array('takepospay', explode(':', $parameters['context']))) { // // global $db, $conf, $user, $menus, $langs; // // $menus = null; // // $r = 0; // // $folio = 82828; // // $menus[$r++] = array('title'=>'
Folio: '.$folio.'
', 'action'=>''); // // if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { // // $menus[$r++] = array('title'=>'
'.$langs->trans("New").'
', 'action'=>'New();'); // // } // // if ( ! getDolGlobalString('TAKEPOS_HIDE_HISTORY')) { // // $menus[$r++] = array('title'=>'
'.$langs->trans("History").'
', 'action'=>'History();'); // // } // // $menus[$r++] = array('title'=>'
'.$langs->trans("Payment").'
', 'action'=>'CloseBill();'); // // print ''; // $form = new Form($db); // // $form->load_cache_conditions_paiements(); // // print '
';
        //         //     print_r($form);
        //         // print '
'; // print '
'; // print 'Condiciones de Pago'; // print $form->getSelectConditionsPaiements(GETPOST('condicionespago'), 'condicionespago'); // print '
'; // } // } /* * **** **** **** **** **** **** **** **** **** **** **** **** **** * * * * Inicia Funciones para mostrar información adicional en el listado de Factura * * * * **** **** **** **** **** **** **** **** **** **** **** **** **** * */ // public function printFieldListSelect($parameters) // { // if (in_array($parameters['currentcontext'], array('invoicelist'))) { // ### // return ",xml.uuid as uuid, xml.cancelado as status, xml.fecha_emision as fecha_emision"; // } // } // public function printFieldListFrom($parameters) // { // if (in_array($parameters['currentcontext'], array('invoicelist'))) { // return " LEFT JOIN " . MAIN_DB_PREFIX . "cfdimx as xml on f.rowid = xml.fk_facture"; // } // } // public function printFieldListWhere($parameters) // { // if (in_array($parameters['currentcontext'], array('invoicelist'))) { // $search_cfdistatus = GETPOST('search_cfdistatus'); // $search_uuid = GETPOST('search_uuid'); // $search_femision = GETPOST('search_femision'); // if (empty($search_cfdistatus)) { // $s = $_SESSION['lastsearch_values_tmp_compta/facture/list.php']; // $s = json_decode($s, true); // $search_cfdistatus = $s['search_cfdistatus']; // } // if (!empty($search_uuid)) { // $search_uuid = " AND xml.uuid LIKE '%" . $search_uuid . "%' "; // } else { // $search_uuid = null; // } // if (!empty($search_femision)) { // $search_cfdistatus .= " AND xml.fecha_emision LIKE '%" . $search_femision . "%'"; // } // switch ($search_cfdistatus) { // case null: // return null . $search_uuid; // break; // case -1: // return null . $search_uuid; // break; // case 2: // return " AND xml.cancelado IS NULL "; // break; // default: // return " AND xml.cancelado = " . $search_cfdistatus; // break; // } // } // } // public function printFieldListOption($parameters) // { // if (in_array($parameters['currentcontext'], array('invoicelist'))) { // print ''; // echo ''; // print ''; // print ''; // echo ''; // print ''; // $liststatus = [ // 0 => 'Timbrada', // 1 => 'Cancelada', // 2 => 'Sin Timbrar', // ]; // $search_cfdistatus = GETPOST('search_cfdistatus'); // if ($search_cfdistatus == null) { // $s = $_SESSION['lastsearch_values_tmp_compta/facture/list.php']; // $s = json_decode($s, true); // $search_cfdistatus = $s['search_cfdistatus']; // } // $form = new Form($this->db); // print ''; // print $form->selectarray('search_cfdistatus', $liststatus, $search_cfdistatus, 1, 0, 0, '', 0, 0, 0, '', '', 1); // print ''; // } // } // public function printFieldListTitle($parameters) // { // if (in_array($parameters['currentcontext'], array('invoicelist'))) { // // echo '
';var_dump($parameters);echo '
'; // $sortorder = GETPOST('sortorder'); // if ($sortorder == "ASC") { // $sortorder = "DESC"; // } // if ($sortorder == "DESC") { // $sortorder = "ASC"; // } // print_liste_field_titre('Fecha Emision', $_SERVER["PHP_SELF"], "xml.fecha_emision", "", "", "align='center'", 'xml.fecha_emision', $sortorder); // print_liste_field_titre('UUID', $_SERVER["PHP_SELF"], "xml.uuid", "", "", "align='center'", 'xml.uuid', $sortorder); // print_liste_field_titre('Estado', $_SERVER["PHP_SELF"], "xml.cancelado", "", "", "align='center'", 'xml.cancelado', $sortorder); // } // } // public function printFieldListValue($parameters) // { // if (in_array($parameters['currentcontext'], array('invoicelist'))) { // echo '' . $parameters['obj']->fecha_emision . ''; // echo '' . $parameters['obj']->uuid . ''; // $ref = explode('-', $parameters['obj']->ref); // // echo '
';
        //         // var_dump($parameters['obj']);
        //         // echo '
'; // echo ''; // if ($parameters['obj']->uuid != null) { // if ($parameters['obj']->status == 0) { // echo 'Timbrada'; // } else { // echo 'Cancelada'; // } // } else { // echo 'Sin Timbrar'; // } // echo ''; // } // } /* * **** **** **** **** **** **** **** **** **** **** **** **** **** * * * * Termina Funciones para mostrar información adicional en el listado de Factura * * * * **** **** **** **** **** **** **** **** **** **** **** **** **** * */ } ?>