Пример #1
0
 public function __construct(&$db)
 {
     $alb_cli = new albaran_cliente();
     echo "Ejecutando tareas para los " . FS_ALBARANES . " de cliente...\n";
     $alb_cli->cron_job();
     $alb_pro = new albaran_proveedor();
     echo "Ejecutando tareas para los " . FS_ALBARANES . " de proveedor...\n";
     $alb_pro->cron_job();
     $articulo = new articulo();
     echo "Ejecutando tareas para los artículos...";
     $articulo->cron_job();
     $asiento = new asiento();
     echo "\nEjecutando tareas para los asientos...\n";
     $asiento->cron_job();
     if (FS_LIBROS_CONTABLES) {
         $libro = new libro_mayor();
         echo "Generamos el libro mayor para cada subcuenta y el libro diario para cada ejercicio...";
         $libro->cron_job();
         $inventarios_balances = new inventarios_balances();
         echo "\nGeneramos el libro de inventarios y balances para cada ejercicio...";
         $inventarios_balances->cron_job();
     } else {
         $libro = new libro_mayor();
         echo "Comprobamos algunas subcuentas...";
         $libro->cron_job();
     }
 }
 protected function process()
 {
     $this->show_fs_toolbar = FALSE;
     $this->ejercicio = new ejercicio();
     if (isset($_GET['balance']) and isset($_GET['eje'])) {
         $this->template = FALSE;
         $iba = new inventarios_balances();
         if ($_GET['balance'] == 'pyg') {
             $iba->generar_pyg($_GET['eje']);
         } else {
             $iba->generar_sit($_GET['eje']);
         }
     }
 }
 private function balance_sumas_y_saldos()
 {
     $eje = $this->ejercicio->get($_POST['codejercicio']);
     if ($eje) {
         if (strtotime($_POST['desde']) < strtotime($eje->fechainicio) or strtotime($_POST['hasta']) > strtotime($eje->fechafin)) {
             $this->new_error_msg('La fecha está fuera del rango del ejercicio.');
         } else {
             $this->template = FALSE;
             $pdf_doc = new fs_pdf();
             $pdf_doc->pdf->addInfo('Title', 'Balance de situación de ' . $this->empresa->nombre);
             $pdf_doc->pdf->addInfo('Subject', 'Balance de situación de ' . $this->empresa->nombre);
             $pdf_doc->pdf->addInfo('Author', $this->empresa->nombre);
             $pdf_doc->pdf->ezStartPageNumbers(570, 800, 10, 'left', '{PAGENUM} de {TOTALPAGENUM}');
             $excluir = FALSE;
             if (isset($eje->idasientocierre) and isset($eje->idasientopyg)) {
                 $excluir = array($eje->idasientocierre, $eje->idasientopyg);
             }
             $iba = new inventarios_balances();
             if ($_POST['tipo'] == '3') {
                 $iba->sumas_y_saldos3($this->db, $pdf_doc, $eje, 'de ' . $_POST['desde'] . ' a ' . $_POST['hasta'], $_POST['desde'], $_POST['hasta'], $excluir, FALSE);
             } else {
                 if ($_POST['tipo'] == '4') {
                     $iba->sumas_y_saldos_all($pdf_doc, $eje, 'de ' . $_POST['desde'] . ' a ' . $_POST['hasta'], $_POST['desde'], $_POST['hasta'], $excluir, FALSE);
                 } else {
                     $iba->sumas_y_saldos($pdf_doc, $eje, 'de ' . $_POST['desde'] . ' a ' . $_POST['hasta'], $_POST['desde'], $_POST['hasta'], $excluir, FALSE);
                 }
             }
             $pdf_doc->show();
         }
     }
 }
 protected function private_core()
 {
     $this->balance = new balance();
     $this->balance_cuenta_a = new balance_cuenta_a();
     $this->ejercicio = new ejercicio();
     if (isset($_REQUEST['buscar_subcuenta'])) {
         /// esto es para el autocompletar las subcuentas de la vista
         $this->buscar_subcuenta();
     } else {
         if (isset($_GET['diario'])) {
             $this->libro_diario_csv($_GET['diario']);
         } else {
             if (isset($_GET['balance']) and isset($_GET['eje'])) {
                 $this->template = FALSE;
                 $iba = new inventarios_balances($this->db);
                 if ($_GET['balance'] == 'pyg') {
                     $iba->generar_pyg($_GET['eje']);
                 } else {
                     $iba->generar_sit($_GET['eje']);
                 }
             } else {
                 if (isset($_POST['informe'])) {
                     if ($_POST['informe'] == 'sumasysaldos') {
                         $this->balance_sumas_y_saldos();
                     } else {
                         if ($_POST['informe'] == 'situacion') {
                             $this->balance_situacion();
                         } else {
                             if ($_POST['informe'] == 'perdidasyg') {
                                 $this->balance_perdidasyg();
                             } else {
                                 if ($_POST['informe'] == 'librom') {
                                     if ($_POST['filtro'] == '') {
                                         $this->libro_diario_csv($_POST['codejercicio'], $_POST['desde'], $_POST['hasta']);
                                     } else {
                                         if (isset($_POST['codgrupo'])) {
                                             $this->libro_mayor_csv($_POST['codejercicio'], $_POST['desde'], $_POST['hasta'], $_POST['codgrupo']);
                                         } else {
                                             if (isset($_POST['codepigrafe'])) {
                                                 $this->libro_mayor_csv($_POST['codejercicio'], $_POST['desde'], $_POST['hasta'], FALSE, $_POST['codepigrafe']);
                                             } else {
                                                 if (isset($_POST['codcuenta'])) {
                                                     $this->libro_mayor_csv($_POST['codejercicio'], $_POST['desde'], $_POST['hasta'], FALSE, FALSE, $_POST['codcuenta']);
                                                 } else {
                                                     if (isset($_POST['codsubcuenta'])) {
                                                         $this->libro_mayor_csv($_POST['codejercicio'], $_POST['desde'], $_POST['hasta'], FALSE, FALSE, FALSE, $_POST['codsubcuenta']);
                                                     } else {
                                                         $this->template = 'ajax/informe_libro_mayor';
                                                         $this->grupos = FALSE;
                                                         $this->epigrafes = FALSE;
                                                         $this->cuentas = FALSE;
                                                         if ($_POST['filtro'] == 'grupo') {
                                                             $ge = new grupo_epigrafes();
                                                             $this->grupos = $ge->all_from_ejercicio($_POST['codejercicio']);
                                                         } else {
                                                             if ($_POST['filtro'] == 'epigrafe') {
                                                                 $ep = new epigrafe();
                                                                 $this->epigrafes = $ep->all_from_ejercicio($_POST['codejercicio']);
                                                             } else {
                                                                 if ($_POST['filtro'] == 'cuenta') {
                                                                     $cuenta = new cuenta();
                                                                     $this->cuentas = $cuenta->full_from_ejercicio($_POST['codejercicio']);
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Пример #5
0
 $alb_cli = new albaran_cliente();
 echo "Ejecutando tareas para los " . FS_ALBARANES . " de cliente...\n";
 $alb_cli->cron_job();
 $alb_pro = new albaran_proveedor();
 echo "Ejecutando tareas para los " . FS_ALBARANES . " de proveedor...\n";
 $alb_pro->cron_job();
 $articulo = new articulo();
 echo "Ejecutando tareas para los artículos...";
 $articulo->cron_job();
 $asiento = new asiento();
 echo "\nEjecutando tareas para los asientos...\n";
 $asiento->cron_job();
 $libro = new libro_mayor();
 echo "Generamos el libro mayor para cada subcuenta y el libro diario para cada ejercicio...";
 $libro->cron_job();
 $inventarios_balances = new inventarios_balances();
 echo "\nGeneramos el libro de inventarios y balances para cada ejercicio...";
 $inventarios_balances->cron_job();
 /*
  * Ahora ejecutamos el cron de cada plugin que tenga cron y esté activado
  */
 if (file_exists('tmp/enabled_plugins')) {
     foreach (scandir(getcwd() . '/tmp/enabled_plugins') as $f) {
         if (is_string($f) and strlen($f) > 0 and !is_dir($f)) {
             if (file_exists('plugins/' . $f)) {
                 if (file_exists('plugins/' . $f . '/cron.php')) {
                     echo "\n\n***********************\nEjecutamos el cron.php del plugin " . $f . "\n";
                     include 'plugins/' . $f . '/cron.php';
                     echo "\n***********************\n";
                 }
             } else {