Example #1
0
 function filteredgrid()
 {
     $this->rapyd->load('datafilter', 'datagrid2');
     $modbus = array('tabla' => 'sinv', 'columnas' => array('codigo' => 'Código', 'descrip' => 'Descripción', 'precio1' => 'Precio 1', 'precio2' => 'Precio 2', 'precio3' => 'Precio 3', 'precio4' => 'Precio 4'), 'filtro' => array('codigo' => 'Código', 'descrip' => 'Descripción'), 'retornar' => array('codigo' => 'codigo'), 'titulo' => 'Buscar en inventario');
     $boton = $this->datasis->modbus($modbus);
     $opciones = array();
     $mSQL = 'SELECT SQL_BIG_RESULT fecha FROM maesfisico GROUP BY fecha ORDER BY fecha DESC LIMIT 5';
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         $opciones[$row->fecha] = dbdate_to_human($row->fecha);
     }
     $filter = new DataFilter("Kardex de Inventario");
     //$filter->codigo = new inputField("Código De Producto", "codigo");
     //$filter->codigo->append($boton);
     $filter->ubica = new dropdownField("Almacen", "ubica");
     $filter->ubica->option("", "Todos");
     $filter->ubica->db_name = 'a.ubica';
     $filter->ubica->options("SELECT ubica,CONCAT(ubica,' ',ubides) descrip FROM caub WHERE gasto='N' ");
     $filter->ubica->operator = "=";
     $filter->ubica->clause = "where";
     $filter->fecha = new dropdownField("Fecha", "fecha");
     $filter->fecha->db_name = 'a.fecha';
     //$filter->fecha->options("SELECT SQL_BIG_RESULT fecha,fecha descrip FROM maesfisico GROUP BY fecha ORDER BY fecha DESC LIMIT 5 ");
     $filter->fecha->operator = "=";
     $filter->fecha->clause = "where";
     $filter->buttons("reset", "search");
     $filter->build();
     $data['lista'] = $filter->output;
     $data['forma'] = '';
     $data['titulo'] = $this->rapyd->get_head() . "<center><h2>Kardex de Inventario</h2></center>";
     $this->layout->buildPage('ventas/view_ventas', $data);
 }
Example #2
0
 function entrega($ffirma, $id, $status)
 {
     if (empty($ffirma) && ($status = 'E2')) {
         return anchor('tesoreria/firmach/entre/' . $id, 'Firmar');
     } else {
         return dbdate_to_human($ffirma);
     }
 }
Example #3
0
 function entrega($ffirma, $id, $status)
 {
     if (empty($ffirma) && ($status = 'E2')) {
         return anchor('tesoreria/chequecaja/entre/' . $id, 'Recibir');
     } else {
         return dbdate_to_human($ffirma);
     }
 }
Example #4
0
 function obser($gene, $estampa, $metodo)
 {
     if (empty($gene) or empty($estampa)) {
         return "<span id='obs_{$metodo}'>Niguna</span>";
     }
     $hestampa = dbdate_to_human($estampa, 'd/m/Y h:i a');
     $hgene = substr($gene, 4) . '/' . substr($gene, 0, 4);
     return "<span id='obs_{$metodo}'>Generado el <b>{$hestampa}</b> para el mes <b>{$hgene}</b></span>";
 }
Example #5
0
 function build()
 {
     $this->_getValue();
     $output = "";
     rapydlib("colorpicker");
     if (!isset($this->size)) {
         $this->size = 25;
     }
     switch ($this->status) {
         case "show":
             if (!isset($this->value)) {
                 $value = RAPYD_FIELD_SYMBOL_NULL;
             } elseif ($this->value == "") {
                 $value = "";
             } else {
                 $value = $this->value;
             }
             $output = $value;
             break;
         case "create":
         case "modify":
             $value = "";
             //integrazione con jscalendar
             if ($this->value != "") {
                 if ($this->is_refill) {
                     $value = $this->value;
                 } else {
                     $value = $this->value;
                 }
             }
             $attributes = array('name' => $this->name, 'id' => $this->name, 'type' => $this->type, 'value' => $value, 'maxlength' => $this->maxlength, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
             $output = form_input($attributes);
             //$output .= '<img src="'.RAPYD_DIR.'images/spacer.gif" style="width:15px;height:15px;background-color:'.$value.';vertical-align:middle;" id="'.$this->name.'_image_pick" /> <A HREF="#" onClick="cp2.select(document.getElementById(\''.$this->name.'\'),\''.$this->name.'_pick\');return false;" NAME="'.$this->name.'_pick" ID="'.$this->name.'_pick">Paleta</A>' . $this->extra_output;
             $output .= '<A HREF="#" onClick="cp2.select(document.getElementById(\'' . $this->name . '\'),\'' . $this->name . '_pick\');return false;" NAME="' . $this->name . '_pick" ID="' . $this->name . '_pick">Paleta</A>' . $this->extra_output;
             $output .= HTML::javascriptTag('cp2.writeDiv()');
             break;
         case "disabled":
             //versione encoded
             $output = dbdate_to_human($this->value, $this->format);
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #6
0
 function _traedatacenter($psucu = '*', $metodo, $fecha = null)
 {
     $obj = '_' . str_replace('_', '', $metodo);
     if (empty($fecha)) {
         $fecha = date('Ymd');
     }
     //if(!method_exists(importar,$obj)) { echo "Error metodo $metodo no existe \n"; return false;}
     if (!$this->__chekfecha($fecha)) {
         echo "Error fecha no valida \n";
         return false;
     }
     if ($psucu != '*') {
         $where = 'AND codigo =' . $this->db->escape($psucu);
     } else {
         $where = '';
     }
     $sucu = $this->sucu;
     $query = $this->db->query("SELECT * FROM sucumon WHERE codigo<>{$sucu} AND activo='S' {$where}");
     if ($query->num_rows() > 0) {
         $result = $query->result();
         foreach ($result as $row) {
             $config['hostname'] = 'localhost';
             $config['username'] = '******';
             $config['password'] = '';
             $config['database'] = trim($row->db_nombre);
             $config['dbdriver'] = 'mysql';
             $config['dbprefix'] = '';
             $config['pconnect'] = FALSE;
             $config['db_debug'] = TRUE;
             $config['cache_on'] = FALSE;
             $config['cachedir'] = "";
             $config['char_set'] = 'latin1';
             $config['dbcollat'] = 'latin1_swedish_ci';
             $this->db = $this->load->database($config, true);
             echo 'Sucursal ' . $row->sucursal . ' en ' . $this->db->database . ' ' . dbdate_to_human($fecha) . ': ' . $metodo;
             $rt = importar::$obj($row->codigo, $fecha);
             echo " {$rt} \n";
         }
     }
 }
Example #7
0
     $data['title'] = ' Tabla de montos ';
     //$data['script']  = $script;
     $data["head"] = $this->rapyd->get_head() . script("jquery.pack.js") . script("plugins/jquery.numeric.pack.js") . script("plugins/jquery.floatnumber.js");
     $this->load->view('view_ventanas', $data);
 }
 function creanomi()
 {
     $c = $this->datasis->dameval("SELECT COUNT(*) FROM prenom");
     $error = '';
     if ($c > 0) {
         $noco = $this->datasis->damerow("SELECT a.nombre,b.fecha,a.tipo FROM noco a JOIN prenom b ON a.codigo=b.contrato LIMIT 1");
         if (count($noco) > 0) {
             $descrip = $noco['nombre'];
             $mFECHAS = $this->datasis->periodo($noco['tipo'], $noco['fecha']);
             $descrip .= ' Desde el ' . dbdate_to_human($mFECHAS[0]) . ' Al ' . dbdate_to_human($mFECHAS[1]);
             if ($noco['tipo'] == 'S') {
                 $descrip .= " Semana del año: " . date('W', $noco['fecha']);
             }
         } else {
             $descrip = '';
         }
         $descripe = $this->db->escape($descrip);
         $mSQL = "INSERT INTO nomi (fecha,status,descrip)values(now('%y%m%d'),'P',{$descripe})";
         $this->db->query($mSQL);
         $nomi = $this->db->insert_id();
         $query = "\r\n\t\t\tINSERT INTO nomina (numero,frecuencia,contrato,codigo,nombre,concepto,tipo,descrip,formula     ,monto  ,fecha  ,  valor, estampa          ,fechap  ,trabaja,modo,orden,vari1,vari2,vari3,vari4,vari5,vari6,vari7,vari8)\r\n\t\t\tSELECT {$nomi},b.tipo frecuencia ,a.contrato,a.codigo,a.nombre,a.concepto,a.tipo,a.descrip,a.formula,a.monto,a.fecha,a.valor,now('Ymd') estampa,a.fechap,a.trabaja,a.modo,a.orden,vari1,vari2,vari3,vari4,vari5,vari6,vari7,vari8\r\n\t\t\tFROM prenom a JOIN noco b ON a.contrato = b.codigo\r\n\t\t\t";
         if (!$this->db->query($query)) {
             $error .= "<div class='alert'>No se Pudo Guardar La nomina</div>";
         }
         $modo = $this->datasis->dameval("SELECT modo FROM prenom LIMIT 1");
         if ($modo == 2) {
             $query = "INSERT INTO asignomi (numero,codigoadm,fondo,codigopres,monto,denominacion)\r\n\t\t\t\tSELECT nomi,f.codigoadm,f.fondo,f.codigopres,SUM(valor),e.denominacion FROM (\r\n\t\t\t\tSELECT {$nomi} nomi,e.codigoadm,e.fondo,e.codigopres,(valor)\r\n\t\t\t\tFROM prenom a\r\n\t\t\t\tJOIN conc d ON a.concepto = d.concepto\r\n\t\t\t\tJOIN pers b ON a.codigo = b.codigo\r\n\t\t\t\tJOIN carg e ON b.cargo=e.cargo\r\n\t\t\t\tJOIN divi c ON b.divi = c.division\r\n\t\t\t\tWHERE a.tipo='A'\r\n\t\t\t\t) f\r\n\t\t\t\tLEFT JOIN v_presaldo e ON f.codigoadm=e.codigoadm AND f.fondo = e.fondo AND f.codigopres=e.codigo\r\n\t\t\t\tGROUP BY f.codigoadm,f.fondo,f.codigopres";
         } else {
             //,IF(d.tipoa='A',IF(LENGTH(TRIM(b.fondo))>0,b.fondo,IF(LENGTH(TRIM(d.fondo))>0,d.fondo,c.fondo))),IF(d.tipoa='C',IF(LENGTH(TRIM(d.fondo))>0,d.fondo,c.fondo),IF(d.tipoa='P'	,b.fondo,c.fondo))) fondo
             $query = "INSERT INTO asignomi (numero,codigoadm,fondo,codigopres,monto,denominacion)\r\n\t\t\t\tSELECT nomi,f.codigoadm,f.fondo,f.codigopres,SUM(valor),e.denominacion FROM (\r\n\t\t\t\tSELECT {$nomi} nomi\r\n\t\t\t\t\r\n\t\t\t\t,IF(d.tipoa='A',IF(LENGTH(TRIM(b.codigoadm))>0,b.codigoadm,IF(LENGTH(TRIM(d.codigoadm))>0,d.codigoadm,c.codigoadm)),IF(d.tipoa='C',IF(LENGTH(TRIM(d.codigoadm))>0,d.codigoadm,c.codigoadm),IF(d.tipoa='P'\t,b.codigoadm,'c.codigoadm'))) codigoadm\r\n\t\t\t\t\r\n\t\t\t\t,IF(LENGTH(TRIM(b.fondo))>0,b.fondo,IF(LENGTH(TRIM(d.fondo))>0,d.fondo,c.fondo)) fondo\r\n\t\t\t\t,IF(d.tipoa='A',IF(LENGTH(TRIM(b.codigopres))>0,b.codigopres,d.codigopres),IF(d.tipoa='C',d.codigopres,IF(d.tipoa='P'\t,b.codigopres,''))) codigopres\r\n\t\t\t\t,(valor)\r\n\t\t\t\tFROM prenom a\r\n\t\t\t\tJOIN conc d ON a.concepto = d.concepto\r\n\t\t\t\tLEFT JOIN pers b ON a.codigo = b.codigo\r\n\t\t\t\tLEFT JOIN divi c ON b.divi = c.division\r\n\t\t\t\tWHERE a.tipo='A'\r\n\t\t\t\tAND a.valor<>0\r\n\t\t\t\t) f\r\n\t\t\t\tLEFT JOIN v_presaldo e ON f.codigoadm=e.codigoadm AND f.fondo = e.fondo AND f.codigopres=e.codigo\r\n\t\t\t\tGROUP BY f.codigoadm,f.fondo,f.codigopres\r\n\t\t\t\tORDER BY f.codigoadm,f.codigopres";
         }
         if (!$this->db->query($query)) {
             $error .= "<div calss='alert'>No se Pudieron Guardar Las asignaciones de nomina</div>";
         }
         $query = "INSERT INTO retenomi (numero,cod_prov,monto,nombre)\r\n\t\t\tSELECT {$nomi},c.cod_prov,SUM(-1*valor) a,d.nombre\r\n\t\t\tFROM prenom a\r\n\t\t\tJOIN conc c ON a.concepto = c.concepto\r\n\t\t\tJOIN sprv d ON c.cod_prov=d.proveed\r\n\t\t\tWHERE a.tipo='D' AND a.valor<>0\r\n\t\t\tGROUP BY c.cod_prov";
         if (!$this->db->query($query)) {
             $error .= "<div calss='alert'>No se Pudieron Guardar Las Deducciones de nomina</div>";
         }
         $query2 = "INSERT INTO otrosnomi (numero,cod_prov,monto,nombre,codigoadm,fondo,codigopres)\r\n\t\t\tSELECT {$nomi},c.cod_prov,SUM(valor) a,d.nombre,c.codigoadm,c.fondo,c.codigopres\r\n\t\t\tFROM prenom a\r\n\t\t\tJOIN conc c ON a.concepto = c.concepto\r\n\t\t\tJOIN sprv d ON c.cod_prov=d.proveed\r\n\t\t\tWHERE a.tipo='O' AND a.valor<>0\r\n\t\t\tGROUP BY c.cod_prov";
         if (!$this->db->query($query2)) {
             $error .= "<div calss='alert'>No se Pudieron Guardar Otros Conceptos de nomina</div>";
         }
         $query = "UPDATE nomi SET\r\n\t\t\tasig=(SELECT SUM(valor)\tFROM prenom a JOIN noco b ON a.contrato = b.codigo\tJOIN conc c ON a.concepto = c.concepto\tWHERE a.tipo='A' ),\r\n\t\t\trete=(SELECT SUM(-1*valor)\tFROM prenom a JOIN conc c ON a.concepto = c.concepto WHERE a.tipo='D')\r\n\t\t\tWHERE numero={$nomi}";
         if (!$this->db->query($query)) {
             $error .= "<div calss='alert'>No se Pudieron Actualizar las asignaciones y deducciones de nomina</div>";
         }
     } else {
         $error .= "<div class='alert'>No hay prenomina generada</div>";
     }
     if (!empty($error)) {
         $salida = $error;
     } else {
         redirect("nomina/nomi/dataedit/show/{$nomi}");
     }
Example #8
0
 function buscasfac()
 {
     session_write_close();
     $mid = trim($this->input->post('q'));
     $scli = $this->input->post('scli');
     $sclidb = $this->db->escape($scli);
     $rete = 0.75;
     $data = '{}';
     if (empty($scli)) {
         $retArray[0]['label'] = 'Debe seleccionar un cliente primero';
         $retArray[0]['value'] = '';
         $retArray[0]['gtotal'] = 0;
         $retArray[0]['reiva'] = 0;
         $retArray[0]['impuesto'] = 0;
         $retArray[0]['fecha'] = '';
         $retArray[0]['tipo_doc'] = '';
         $data = json_encode($retArray);
         echo $data;
         return;
     }
     if (!preg_match('/(?P<tipo>[a-zA-Z]+)?(?P<numero>\\d+)/', $mid, $match)) {
         $retArray[0]['label'] = 'Parametro de busqueda no valido';
         $retArray[0]['value'] = '';
         $retArray[0]['gtotal'] = 0;
         $retArray[0]['reiva'] = 0;
         $retArray[0]['impuesto'] = 0;
         $retArray[0]['fecha'] = '';
         $retArray[0]['tipo_doc'] = '';
         $data = json_encode($retArray);
         echo $data;
         return;
     }
     if ($mid !== false) {
         $retArray = $retorno = array();
         if (!empty($match['tipo'])) {
             $match['tipo'] = strtoupper($match['tipo']);
             if (strlen($match['tipo']) > 1 && substr($match['tipo'], -1) == 'M') {
                 //Es una factura manual
                 $match['tipo'] = substr($match['tipo'], 0, -1);
             }
             $wwtipo = ' AND a.tipo_doc=' . $this->db->escape($match['tipo']);
             $smovtipo = '';
         } else {
             $wwtipo = '';
             $smovtipo = ' AND a.tipo_doc IN (\'NC\',\'ND\')';
         }
         $dbnumero = $this->db->escape('%' . $match['numero'] . '%');
         $mSQLs = array();
         if (empty($match['tipo']) || $match['tipo'] == 'F' || $match['tipo'] == 'D' || $match['tipo'] == 'T') {
             $mSQLs[] = "SELECT a.tipo_doc, a.numero, a.nfiscal, a.totalg, a.fecha,a.iva, a.iva*{$rete} AS reiva\n\t\t\t\tFROM  rivc AS c\n\t\t\t\tJOIN itrivc AS b ON c.id=b.idrivc AND c.anulado='N'\n\t\t\t\tRIGHT JOIN sfac AS a ON a.tipo_doc=b.tipo_doc AND a.numero=b.numero\n\t\t\t\tWHERE a.cod_cli={$sclidb} AND a.numero LIKE {$dbnumero} {$wwtipo} AND b.numero IS NULL AND a.tipo_doc <> 'X' AND a.iva>0";
         }
         if (empty($match['tipo']) || $match['tipo'] == 'NC' || $match['tipo'] == 'ND') {
             $mSQLs[] = "SELECT a.tipo_doc, a.numero, a.nfiscal, a.monto AS totalg, a.fecha, a.impuesto AS iva,a.impuesto*{$rete} AS reiva\n\t\t\t\tFROM  rivc AS c\n\t\t\t\tJOIN itrivc AS b ON c.id=b.idrivc AND c.anulado='N'\n\t\t\t\tRIGHT JOIN smov AS a ON a.tipo_doc=b.tipo_doc AND a.numero=b.numero\n\t\t\t\tLEFT  JOIN sfac AS d ON a.transac=d.transac\n\t\t\t\tWHERE a.cod_cli={$sclidb} AND a.numero LIKE {$dbnumero} {$wwtipo}\n\t\t\t\t\tAND b.numero IS NULL\n\t\t\t\t\tAND d.numero IS NULL\n\t\t\t\t\tAND a.observa1 NOT LIKE 'RET%'\n\t\t\t\t\tAND a.impuesto>0 {$smovtipo}";
         }
         if (count($mSQLs) > 0) {
             $mSQL = implode(' UNION ALL ', $mSQLs) . ' ORDER BY numero DESC LIMIT 10';
             $query = $this->db->query($mSQL);
             if ($query->num_rows() > 0) {
                 foreach ($query->result_array() as $row) {
                     $retArray['label'] = $row['tipo_doc'] . '-' . $row['numero'] . ' NF: ' . $row['nfiscal'] . ' ' . $row['totalg'] . ' Bs.';
                     $retArray['value'] = $row['numero'];
                     $retArray['gtotal'] = $row['totalg'];
                     $retArray['reiva'] = ($row['tipo_doc'] == 'D' || $row['tipo_doc'] == 'NC' ? -1 : 1) * round($row['reiva'], 2);
                     $retArray['impuesto'] = $row['iva'];
                     $retArray['fecha'] = dbdate_to_human($row['fecha']);
                     $retArray['tipo_doc'] = $row['tipo_doc'];
                     array_push($retorno, $retArray);
                 }
                 $data = json_encode($retorno);
             } else {
                 $retArray[0]['label'] = 'No se consiguieron efectos para aplicar';
                 $retArray[0]['value'] = '';
                 $retArray[0]['cod_cli'] = '';
                 $retArray[0]['nombre'] = '';
                 $retArray[0]['gtotal'] = 0;
                 $retArray[0]['reiva'] = 0;
                 $retArray[0]['impuesto'] = 0;
                 $retArray[0]['fecha'] = '';
                 $retArray[0]['tipo_doc'] = '';
                 $data = json_encode($retArray);
             }
         }
     }
     echo $data;
 }
Example #9
0
 function liqui($lnumero)
 {
     $dbnumero = $this->db->escape($lnumero);
     $mSQL_1 = "SELECT numero, fecha, status, proveed, nombre, agente, nomage, montofob, gastosi, montocif,\n\t\taranceles, gastosn, montotot, montoiva, montoexc, arribo, factura, cambioofi, cambioreal, peso, transac,\n\t\testampa, usuario, hora, dua, cargoval, control, crm\n\t\tFROM ordi WHERE numero={$dbnumero}";
     $fnombre = 'liquidacion.xls';
     $fname = tempnam('/tmp', $fnombre);
     $this->load->library('workbook', array('fname' => $fname));
     $wb =& $this->workbook;
     $ws =& $wb->addworksheet($lnumero);
     // ANCHO DE LAS COLUMNAS
     $ws->set_column('A:A', 10);
     $ws->set_column('B:B', 35);
     $ws->set_column('C:C', 6);
     $ws->set_column('D:E', 10);
     $ws->set_column('F:F', 6);
     $ws->set_column('G:I', 10);
     $ws->set_column('J:J', 6);
     $ws->set_column('K:Q', 10);
     // FORMATOS
     $h =& $wb->addformat(array("bold" => 1, "size" => 14, "align" => 'left'));
     $h0 =& $wb->addformat(array("bold" => 1, "size" => 10, "align" => 'left'));
     $h1 =& $wb->addformat(array("bold" => 1, "size" => 11, "align" => 'center'));
     $h2 =& $wb->addformat(array("bold" => 1, "size" => 14, "align" => 'left', "fg_color" => 'silver'));
     $h3 =& $wb->addformat(array("bold" => 1, "size" => 9));
     $h3->set_merge();
     $h4 =& $wb->addformat(array("bold" => 1, "size" => 9, "align" => 'right', "num_format" => '#,##0.00'));
     $codesc =& $wb->addformat(array("bold" => 0, "size" => 8, "align" => 'left', "fg_color" => 26));
     $codesc->set_border(1);
     $numcer =& $wb->addformat(array("bold" => 0, "size" => 8, "align" => 'right', "fg_color" => 26));
     $numcer->set_border(1);
     $numpri =& $wb->addformat(array("num_format" => '#,##0.00', "size" => 8, "fg_color" => 44));
     $numpri->set_border(1);
     $numseg =& $wb->addformat(array("num_format" => '#,##0.00', "size" => 8, "fg_color" => 42));
     $numseg->set_border(1);
     $numter =& $wb->addformat(array("num_format" => '#,##0.00', "size" => 8, "fg_color" => 41));
     $numter->set_border(1);
     $numcua =& $wb->addformat(array("num_format" => '#,##0.00', "size" => 8, "fg_color" => 41));
     $numcua->set_border(1);
     $numqui =& $wb->addformat(array("num_format" => '#,##0.00', "size" => 8, "fg_color" => 45));
     $numqui->set_border(1);
     $titulo =& $wb->addformat(array("bold" => 1, "size" => 8, "merge" => 1, "fg_color" => 'silver', 'align' => 'vcenter'));
     $titulo->set_text_wrap();
     $titulo->set_text_h_align(2);
     $titulo->set_border(1);
     $titulo->set_merge();
     $titpri =& $wb->addformat(array("bold" => 1, "size" => 9, "merge" => 1, "fg_color" => 26));
     $titpri->set_text_wrap();
     $titpri->set_border(1);
     $titpri->set_merge();
     $titseg =& $wb->addformat(array("bold" => 1, "size" => 9, "merge" => 1, "fg_color" => 44));
     $titseg->set_text_wrap();
     $titseg->set_border(1);
     $titseg->set_merge();
     $titter =& $wb->addformat(array("bold" => 1, "size" => 9, "merge" => 1, "fg_color" => 42));
     $titter->set_text_wrap();
     $titter->set_border(1);
     $titter->set_merge();
     $titcua =& $wb->addformat(array("bold" => 1, "size" => 9, "merge" => 1, "fg_color" => 41));
     $titcua->set_text_wrap();
     $titcua->set_border(1);
     $titcua->set_merge();
     $titqui =& $wb->addformat(array("bold" => 1, "size" => 9, "merge" => 1, "fg_color" => 45, 'align' => 'vcenter'));
     //$titqui->set_text_v_align(6);
     $titqui->set_text_wrap();
     $titqui->set_border(1);
     $titqui->set_merge();
     $cuerpo =& $wb->addformat(array('size' => 9));
     $Tnumero =& $wb->addformat(array('num_format' => '#,##0.00', 'size' => 9, 'bold' => 1, 'fg_color' => 'silver'));
     $Rnumero =& $wb->addformat(array('num_format' => '#,##0.00', 'size' => 9, 'bold' => 1, 'align' => 'right'));
     $enc = $this->db->query($mSQL_1);
     $row1 = $enc->row();
     $proveed = $row1->proveed;
     $nombre = $row1->nombre;
     $agente = $row1->agente;
     $nomage = $row1->nomage;
     $numerol = $row1->numero;
     $fecha = dbdate_to_human($row1->fecha);
     $arribo = dbdate_to_human($row1->arribo);
     $factura = $row1->factura;
     $dua = $row1->dua;
     $montofob = $row1->montofob;
     $gastosi = $row1->gastosi;
     $montocif = $row1->montocif;
     $aranceles = $row1->aranceles;
     $gastosn = $row1->gastosn;
     $montotot = $row1->montotot;
     $montoiva = $row1->montoiva;
     $montoexc = $row1->montoexc;
     $cambioofi = $row1->cambioofi;
     $cambioreal = $row1->cambioreal;
     // COMIENZA A ESCRIBIR
     $ws->write(1, 0, $this->datasis->traevalor('TITULO1'), $h);
     $ws->write(2, 0, $this->datasis->traevalor('TITULO2'), $h0);
     $ws->write(3, 0, 'RIF: ' . $this->datasis->traevalor('RIF'), $h0);
     $ws->write(4, 0, " ", $h1);
     $ws->write(1, 8, 'Orden de Importación Nº' . str_pad($lnumero, 8, '0', STR_PAD_LEFT), $h);
     $ws->write(2, 8, 'Fecha: ' . $fecha, $h0);
     $ws->write(3, 8, 'Fecha de LLegada :' . $arribo, $h0);
     $ws->write(4, 8, ' ', $h1);
     $ws->write(5, 0, 'Proveedor: (' . $proveed . ')' . $nombre, $h0);
     for ($i = 1; $i < 6; $i++) {
         $ws->write_blank(5, $i, $h0);
     }
     $ws->write(6, 0, 'Agente Aduanal: (' . $agente . ')' . $nomage, $h0);
     for ($i = 1; $i < 6; $i++) {
         $ws->write_blank(6, $i, $h0);
     }
     $hs = 'Liquidación de Importación (PARA USO INTERNO)';
     $ws->write(8, 0, $hs, $h);
     for ($i = 1; $i < 6; $i++) {
         $ws->write_blank(8, $i, $h);
     }
     $ws->write(5, 8, 'Nro. de Factura:' . $factura, $h0);
     $ws->write(6, 8, 'D.U.A: ' . $dua, $h0);
     // TITULOS
     $mm = 9;
     $ws->write_string($mm, 0, 'Productos', $titpri);
     $ws->write_string($mm + 1, 0, 'Código', $titulo);
     $ws->write_blank($mm, 1, $titpri);
     $ws->write_string($mm + 1, 1, 'Descripción', $titulo);
     $ws->write_blank($mm, 2, $titpri);
     $ws->write_string($mm + 1, 2, 'Cant.', $titulo);
     $ws->write_string($mm, 3, 'Monto en moneda extrajera', $titseg);
     $ws->write_string($mm + 1, 3, 'Precio FOB', $titulo);
     $ws->write_blank($mm, 4, $titseg);
     $ws->write_string($mm + 1, 4, 'Monto FOB', $titulo);
     $ws->write_blank($mm, 5, $titseg);
     $ws->write_string($mm + 1, 5, 'Part%', $titulo);
     $ws->write_blank($mm, 6, $titseg);
     $ws->write_string($mm + 1, 6, 'Gastos Exterior', $titulo);
     $ws->write_blank($mm, 7, $titseg);
     $ws->write_string($mm + 1, 7, 'Monto CIF', $titulo);
     $ws->write_string($mm, 8, 'Liquidación a Cambio Oficial ' . $cambioofi, $titter);
     $ws->write_string($mm + 1, 8, 'Monto CIF Oficial ', $titulo);
     $ws->write_blank($mm, 9, $titter);
     $ws->write_string($mm + 1, 9, '%', $titulo);
     $ws->write_blank($mm, 10, $titter);
     $ws->write_string($mm + 1, 10, 'Arancel', $titulo);
     $ws->write_blank($mm, 11, $titter);
     $ws->write_string($mm + 1, 11, 'Gastos Nacionales', $titulo);
     $ws->write_blank($mm, 12, $titter);
     $ws->write_string($mm + 1, 12, 'Importe Nacional', $titulo);
     $ws->write_string($mm, 13, 'Liquidación a cambio real ' . $cambioreal, $titcua);
     $ws->write_string($mm + 1, 13, 'Monto CIF Real ' . $cambioreal, $titulo);
     $ws->write_blank($mm, 14, $titcua);
     $ws->write_string($mm + 1, 14, 'Importe Nacional Cambio Real ', $titulo);
     $ws->write_blank($mm, 15, $titcua);
     $ws->write_string($mm + 1, 15, 'Costo unitario', $titulo);
     $ws->write_string($mm, 16, ' ', $titqui);
     $ws->write_string($mm + 1, 16, 'Cargo Valor', $titqui);
     $mm = $mm + 2;
     $dd = $mm + 1;
     $mSQL = "SELECT numero, fecha, codigo, descrip, cantidad, costofob, importefob, gastosi, costocif,\n\t\timportecif, importeciflocal, importecifreal,codaran, arancel, montoaran, gastosn, costofinal, importefinal, participam*100 AS part,\n\t\tparticipao, arancif, iva, precio1, precio2, precio3, precio4, estampa, hora, usuario, id,\n\t\timportecifreal-importeciflocal AS cargo,\n\t\timportecifreal+gastosn+montoaran AS importenac,\n\t\t(importecifreal+gastosn+montoaran)/cantidad AS cunitario\n\t\tFROM itordi WHERE numero={$dbnumero}";
     $mc = $this->db->query($mSQL);
     if ($mc->num_rows() > 0) {
         foreach ($mc->result() as $row) {
             $ws->write_string($mm, 0, $row->codigo, $codesc);
             $ws->write_string($mm, 1, $row->descrip, $codesc);
             $ws->write_number($mm, 2, $row->cantidad, $numcer);
             $ws->write_number($mm, 3, $row->costofob, $numpri);
             $ws->write_number($mm, 4, $row->importefob, $numpri);
             $ws->write_number($mm, 5, $row->part, $numpri);
             $ws->write_number($mm, 6, $row->gastosi, $numpri);
             $ws->write_number($mm, 7, $row->importecif, $numpri);
             $ws->write_number($mm, 8, $row->importeciflocal, $numseg);
             $ws->write_number($mm, 9, $row->arancel, $numseg);
             $ws->write_number($mm, 10, $row->montoaran, $numseg);
             $ws->write_number($mm, 11, $row->gastosn, $numseg);
             $ws->write_number($mm, 12, $row->importefinal, $numseg);
             $ws->write_number($mm, 13, $row->importecifreal, $numter);
             $ws->write_number($mm, 14, $row->importenac, $numter);
             $ws->write_number($mm, 15, $row->cunitario, $numter);
             $ws->write_number($mm, 16, $row->cargo, $numqui);
             $mm++;
         }
     }
     $celda = $mm + 1;
     $ws->write_blank($mm, 0, $Tnumero);
     $ws->write_string($mm, 1, 'Totales...', $Tnumero);
     $ws->write_blank($mm, 2, $Tnumero);
     $ws->write_blank($mm, 3, $Tnumero);
     $ws->write_formula($mm, 4, "=SUM(E{$dd}:E{$mm})", $Tnumero);
     $ws->write_formula($mm, 5, "=SUM(F{$dd}:F{$mm})", $Tnumero);
     $ws->write_formula($mm, 6, "=SUM(G{$dd}:G{$mm})", $Tnumero);
     $ws->write_formula($mm, 7, "=SUM(H{$dd}:H{$mm})", $Tnumero);
     $ws->write_formula($mm, 8, "=SUM(I{$dd}:I{$mm})", $Tnumero);
     $ws->write_blank($mm, 9, $Tnumero);
     $ws->write_formula($mm, 10, "=SUM(K{$dd}:K{$mm})", $Tnumero);
     $ws->write_formula($mm, 11, "=SUM(L{$dd}:L{$mm})", $Tnumero);
     $ws->write_formula($mm, 12, "=SUM(M{$dd}:M{$mm})", $Tnumero);
     $ws->write_formula($mm, 13, "=SUM(N{$dd}:N{$mm})", $Tnumero);
     $ws->write_formula($mm, 14, "=SUM(O{$dd}:O{$mm})", $Tnumero);
     $ws->write_blank($mm, 15, $Tnumero);
     $ws->write_formula($mm, 16, "=SUM(Q{$dd}:Q{$mm})", $Tnumero);
     $mm = $mm + 2;
     $ws->write_string($mm, 2, 'Costo en US$', $titulo);
     $ws->write_blank($mm, 3, $titulo);
     $ws->write_blank($mm, 4, $titulo);
     $ws->write_string($mm, 5, 'Costo en Bs', $titulo);
     $ws->write_blank($mm, 6, $titulo);
     $ws->write_blank($mm, 7, $titulo);
     $ws->write_string($mm, 8, 'Resumen de Liquidacion', $titulo);
     $ws->write_blank($mm, 9, $titulo);
     $ws->write_blank($mm, 10, $titulo);
     $mm++;
     $montobase = $this->datasis->dameval("SELECT SUM(base) AS base FROM ordiva WHERE ordeni={$dbnumero}");
     $montototal = $montocif * $cambioreal + $gastosn + $aranceles;
     $ws->write_string($mm, 2, 'Monto FOB:', $h3);
     $ws->write_blank($mm, 3, $h3);
     $ws->write_number($mm, 4, $montofob, $h4);
     $ws->write_string($mm, 5, 'Monto CIF:', $h3);
     $ws->write_blank($mm, 6, $h3);
     $ws->write_number($mm, 7, $montocif * $cambioreal, $h4);
     $ws->write_string($mm, 8, 'Monto Exento:', $h3);
     $ws->write_blank($mm, 9, $h3);
     $ws->write_number($mm, 10, $montoexc, $h4);
     $mm++;
     $ws->write_string($mm, 2, 'Gastos Exterior:', $h3);
     $ws->write_blank($mm, 3, $h3);
     $ws->write_number($mm, 4, $gastosi, $h4);
     $ws->write_string($mm, 5, 'Gastos Nacionales:', $h3);
     $ws->write_blank($mm, 6, $h3);
     $ws->write_number($mm, 7, $gastosn, $h4);
     $ws->write_string($mm, 8, 'Base Imponible:', $h3);
     $ws->write_blank($mm, 9, $h3);
     $ws->write_number($mm, 10, $montobase, $h4);
     $mm++;
     $ws->write_string($mm, 2, 'Monto CIF:', $h3);
     $ws->write_blank($mm, 3, $h3);
     $ws->write_number($mm, 4, $montocif, $h4);
     $ws->write_string($mm, 5, 'Aranceles:', $h3);
     $ws->write_blank($mm, 6, $h3);
     $ws->write_number($mm, 7, $aranceles, $h4);
     $ws->write_string($mm, 8, 'Monto IVA:', $h3);
     $ws->write_blank($mm, 9, $h3);
     $ws->write_number($mm, 10, $montoiva, $h4);
     $mm++;
     $ws->write_string($mm, 2, ' ', $h3);
     $ws->write_blank($mm, 3, $h3);
     $ws->write_string($mm, 4, ' ', $h3);
     $ws->write_string($mm, 5, 'Monto Final:', $h3);
     $ws->write_blank($mm, 6, $h3);
     $ws->write_number($mm, 7, $montototal, $h4);
     $ws->write_string($mm, 8, 'Monto Total Bs:', $h3);
     $ws->write_blank($mm, 9, $h3);
     $ws->write_number($mm, 10, $montoiva + $montobase + $montototal - $montobase, $h4);
     $wb->close();
     header("Content-type: application/x-msexcel; name=\"{$fnombre}\"");
     header("Content-Disposition: inline; filename=\"{$fnombre}\"");
     $fh = fopen($fname, 'rb');
     fpassthru($fh);
     unlink($fname);
 }
Example #10
0
 function construyeTabla($pdf, $objt, $limite, $bordev = 1, $pintah = 1)
 {
     $bandTot = 0;
     $bandacu = 0;
     $bandViene = 0;
     $bandTotalizar = 0;
     $bandTotalesPag = 0;
     $espCuerpo = 5;
     //numero de espacion entre el cuerpo y el limite
     $objetos = array('pdf', 'objt');
     $valorCampo = array();
     $objt->SetFont($this->fuenteTabla, 'B', 8);
     /*
      * Construye primera cabezera
      */
     if ($pintah) {
         $objt->setFillColor(0, 0, 0, 5);
     } else {
         $objt->setFillColor(255, 255, 255);
     }
     $cancho = 0;
     foreach ($this->columnas as $colum) {
         if ($colum['pos'] === true) {
             $objt->setX($cancho);
         } else {
             $objt->setX($colum['pos']);
             $cancho += $colum['pos'];
         }
         $cancho += $colum['ancho'];
         $objt->Cell($colum['ancho'], $colum['height'], $colum['titulo'], $colum['borde'], 0, 'C', 1);
     }
     if (count($this->viene) != 0) {
         $objt->ln();
         $this->dibuja_viene($objt);
     }
     if (count($this->totalacu) != 0) {
         $bandacu = 1;
     }
     /*
      * Verifica si hay que calcular totales al final de la tabla
      */
     if (count($this->totalizar) != 0) {
         $bandTotalizar = 1;
     }
     /*
      * Verifica si hay que calcular totales por pagina
      */
     if (count($this->totalesPag) != 0) {
         $bandTotalesPag = 1;
     }
     /*
      * Verifica si hay que calcular subtotales acumulados por pagina
      */
     if (count($this->totales) != 0) {
         $bandTot = 1;
         $bandTotalizar = 1;
         $espCuerpo = 8;
     }
     $objt->ln();
     $pdf = clone $objt;
     $pdf->StartTransaction();
     /*
      * Recorrido del arreglo a imprimir
      */
     foreach ($this->tabla as $items) {
         /*
          * Revisa cual va a ser la altura maxima de la linea
          */
         $mayor = 0;
         foreach ($this->columnas as $colum) {
             $ncamp = $colum['campo'];
             $valorCampo[$ncamp] = $items[$ncamp];
             $nlinea = $objt->getNumLines($valorCampo[$ncamp], $colum['ancho']);
             $tlineas = 4 * $nlinea;
             if ($tlineas > $mayor) {
                 $mayor = $tlineas;
             }
         }
         /*
          * Verifica si la linea a escribir esta dentro del limite predefinido
          * de no ser asi hace los procesos necesarios para continuar en la proxima pagina
          */
         if ($objt->getY() + $mayor + $espCuerpo >= $this->limite) {
             if ($bandTot == 1) {
                 $this->dibuja_total($objt, 1);
             }
             if ($bandTotalesPag == 1) {
                 $this->dibuja_totalPag($objt);
                 $bandTotalesPag = 2;
             }
             if ($objt->getPage() == 1) {
                 $objt->setY($objt->lpiep);
                 $this->pie($objt);
             } else {
                 $objt->setY($objt->lpiem);
                 $this->pie2($objt);
             }
             $objt->addPage($this->orientacion, $this->tamPapel);
             $this->limite = $objt->lpiem;
             $pdf->rollbackTransaction(true);
             $pdf = clone $objt;
             $pdf->StartTransaction();
             $objt->SetY($objt->lencabm);
             $this->encab2($objt);
             $pdf->SetY($pdf->lencabu);
             $this->encab3($pdf);
             /////LLeva titulo tabla con subTotal viene en caso de tener subtotal
             foreach ($objetos as $objT) {
                 if ($pintah) {
                     ${$objT}->setFillColor(0, 0, 0, 5);
                 } else {
                     ${$objT}->setFillColor(255, 255, 255);
                 }
                 ${$objT}->SetFont($this->fuenteTabla, 'B', 8);
                 $cancho = 0;
                 foreach ($this->columnas as $colum) {
                     if ($colum['pos'] === true) {
                         ${$objT}->setX($cancho);
                     } else {
                         ${$objT}->setX($colum['pos']);
                         $cancho += $colum['pos'];
                     }
                     $cancho += $colum['ancho'];
                     ${$objT}->Cell($colum['ancho'], $colum['height'], $colum['titulo'], $colum['borde'], 0, 'C', 1);
                 }
                 ${$objT}->ln();
                 if ($bandTot == 1) {
                     $this->dibuja_total(${$objT}, 0);
                     foreach ($this->TotalizarPP as $key => $value) {
                         $this->TotalizarPP[$key] = 0;
                     }
                     ${$objT}->ln();
                 }
             }
         }
         $entra = 0;
         $lleva = 0;
         foreach ($objetos as $objT) {
             $mayor = ${$objT}->getY() + 4;
             $inicio = ${$objT}->getY();
             /*
              * Escribe el contenido de los campos especificados en la funcion agrega_col(),
              * con los parametros que alli se especificaron
              */
             $cancho = 0;
             foreach ($this->columnas as $colum) {
                 //$$objT->setXY($colum['pos'],$inicio);
                 if ($colum['pos'] === true) {
                     ${$objT}->setXY($cancho, $inicio);
                 } else {
                     ${$objT}->setXY($colum['pos'], $inicio);
                     $cancho += $colum['pos'];
                 }
                 $cancho += $colum['ancho'];
                 $ncamp = $colum['campo'];
                 $w = $colum['ancho'];
                 $borde = $colum['borde'];
                 $align = $colum['alinea'];
                 $fill = $colum['relleno'];
                 $reseth = $colum['reseth'];
                 $stretch = $colum['stretch'];
                 $autopadding = $colum['autopadding'];
                 $valing = $colum['valign'];
                 $est = $colum['estilo'];
                 $tamLetra = $colum['tfuente'];
                 $elemento = true;
                 $valor = "";
                 if ($bandacu == 1 && $entra == 0) {
                     $i = 0;
                     foreach ($this->totalacu as $tot) {
                         $campTot = $tot['campo'];
                         //echo $campTot."=>".$ncamp."<br>";
                         if (isset($valorCampo[$campTot]) && $campTot == $ncamp) {
                             //echo"entra";
                             $this->totalacu[$i]['valor'] += $valorCampo[$ncamp];
                             $elemento = $this->totalacu[$i]['valor'];
                             //echo $ncamp."=>".$campTot.$elemento."<br>";
                         }
                         $i++;
                     }
                 }
                 if ($bandacu == 1 && $entra == 1) {
                     $i = 0;
                     foreach ($this->totalacu as $tot) {
                         $campTot = $tot['campo'];
                         //echo $campTot."=>".$ncamp."<br>";
                         if (isset($valorCampo[$campTot]) && $campTot == $ncamp) {
                             //echo"entra";
                             $elemento = $this->totalacu[$i]['valor'];
                             //echo $ncamp."=>".$campTot.$elemento."<br>";
                         }
                         $i++;
                     }
                 }
                 //echo $elemento."<br>";
                 if ($elemento === true) {
                     $elemento = $valorCampo[$ncamp];
                 }
                 //echo $elemento."<br>=><br>";
                 if ($colum['tdato'] != "") {
                     if ($colum['tdato'] == 1) {
                         $valor = is_numeric($elemento) || strlen($elemento) == 0 ? nformat($elemento) : $elemento;
                     }
                     if ($colum['tdato'] == 2) {
                         $valor = dbdate_to_human($elemento);
                     }
                     if ($colum['tdato'] == 3) {
                         $valor = $elemento == 0 ? '' : nformat($elemento);
                     }
                     if ($colum['tdato'] == 4) {
                         $valor = $elemento == '' ? '' : nformat($elemento);
                     }
                 } else {
                     $valor = $elemento;
                 }
                 ${$objT}->setFont($this->fuenteTabla, $est, $tamLetra);
                 ${$objT}->MultiCell($w, $colum['height'], $valor, $borde, $align, $fill, 1, '', '', $reseth, $stretch, false, $autopadding, 0, $valing);
                 $aux = ${$objT}->getY();
                 if ($aux > $mayor) {
                     $mayor = $aux;
                 }
             }
             $entra = 1;
             /*
              * Para Construir las lineas de las celdas
              */
             $xf = 217;
             $cancho = 0;
             if ($bordev) {
                 foreach ($this->columnas as $colum) {
                     if ($colum['pos'] === true) {
                         $colum['pos'] = $cancho;
                     } else {
                         $cancho += $colum['pos'];
                     }
                     $cancho += $colum['ancho'];
                     ${$objT}->Line($colum['pos'], $inicio, $colum['pos'], $mayor);
                     $xf = $colum['pos'] + $colum['ancho'];
                     ${$objT}->Line($colum['pos'] + $colum['ancho'], $inicio, $colum['pos'] + $colum['ancho'], $mayor);
                     ${$objT}->Line($colum['pos'], $mayor, $xf, $mayor);
                 }
             }
             ${$objT}->setY($mayor);
         }
         /**
          * Aca acumulamos los totales
          */
         if ($bandTot == 1) {
             $i = 0;
             foreach ($this->totales as $tot) {
                 $campTot = $tot['campo'];
                 if (isset($valorCampo[$campTot])) {
                     $this->totales[$i]['valor'] += $valorCampo[$campTot];
                 }
                 $i++;
             }
         }
         if ($bandTotalesPag > 0) {
             if ($bandTotalesPag == 2) {
                 $j = 0;
                 foreach ($this->totalesPag as $tot) {
                     $campTotalesPag = $tot['campo'];
                     if (isset($valorCampo[$campTotalesPag])) {
                         $this->totalesPag[$j]['valor'] = 0;
                     }
                     $j++;
                 }
                 $bandTotalesPag = 1;
             }
             $i = 0;
             foreach ($this->totalesPag as $tot) {
                 $campTot = $tot['campo'];
                 if (isset($valorCampo[$campTot])) {
                     $this->totalesPag[$i]['valor'] += $valorCampo[$campTot];
                 }
                 $i++;
             }
         }
         if ($bandTotalizar == 1) {
             $i = 0;
             foreach ($this->totalizar as $tot) {
                 $campTotalizar = $tot['campo'];
                 if (isset($valorCampo[$campTotalizar])) {
                     $this->totalizar[$i]['valor'] += $valorCampo[$campTotalizar];
                 }
                 $i++;
             }
         }
     }
     $pdf->commitTransaction();
     if ($bandTotalizar == 1) {
         $this->dibuja_totalizar($pdf);
     }
     if ($bandTotalesPag == 1) {
         $this->dibuja_totalPag($pdf);
     }
     $pdf->ln();
     $this->columnas = array();
     return $pdf;
 }
Example #11
0
/**
 * ProteoERP
 *
 * @autor    Andres Hocevar
 * @license  GNU GPL v3
*/
echo $form_begin;
$container_tr = join('&nbsp;', $form->_button_container['TR']);
$container_bl = join('&nbsp;', $form->_button_container['BL']);
$container_br = join('&nbsp;', $form->_button_container['BR']);
if ($form->_status != 'show') {
    if ($form->_status == 'create') {
        $jsfecha = '$(\'#fecha\').val()';
        $jscodban = '$(\'#codbanc\').val()';
    } else {
        $jsfecha = $form->js_escape(dbdate_to_human($form->fecha->value, $form->fecha->format));
        $jscodban = $form->js_escape($form->codbanc->value);
    }
    ?>
<script language="javascript" type="text/javascript">
var bmov_cont =0;

$(function(){
	$("#fecha").datepicker({
		dateFormat:"mm/yy",
		onSelect: function(dateText) {
			cambiaban();
		},
	});

	$("#fecha").focusout(
Example #12
0
    function forcierre($numero)
    {
        $this->rapyd->load('dataform');
        $dbnumero = $this->db->escape($numero);
        $cana = $this->datasis->dameval('SELECT COUNT(*) FROM rcaj WHERE tipo="T" AND numero=' . $dbnumero);
        if ($cana < 1) {
            $data['content'] = 'El efecto a cerrar es inv&aacute;lido o ya fue cerrado ' . anchor('ventas/rcaj/filteredgrid/search', 'Regresar');
            $data['title'] = '<h1>Recepci&oacute;n de cajas</h1>';
            $data['head'] = $this->rapyd->get_head() . script('jquery.pack.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js');
            $this->load->view('view_ventanas', $data);
            return;
        } else {
            $caja = $this->datasis->dameval('SELECT caja FROM rcaj WHERE tipo="T" AND numero=' . $dbnumero);
            if (empty($caja)) {
                $data['content'] = 'Falta registro de la caja ' . anchor('ventas/rcaj/filteredgrid/search', 'Regresar');
                $data['title'] = '<h1>Recepci&oacute;n de cajas</h1>';
                $data['head'] = $this->rapyd->get_head() . script('jquery.pack.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js');
                $this->load->view('view_ventanas', $data);
                return;
            }
        }
        $nomcajero = $this->datasis->dameval('SELECT CONCAT(TRIM(a.cajero),b.nombre) cajero FROM rcaj a JOIN scaj b ON a.cajero=b.cajero WHERE a.tipo="T" AND a.numero=' . $dbnumero);
        $form = new DataForm("ventas/rcaj/forcierre/{$numero}/process");
        $attr = array('class' => 'ui-state-default ui-corner-all', 'onclick' => "javascript:window.location='" . site_url('ventas/rcaj/filteredgrid') . "'", 'value' => 'Regresar');
        $totales = array(0, 0, 0, 0);
        $retiros = array();
        $sel = array('TRIM(tipo) AS tipo', 'SUM(monto) AS monto');
        $this->db->select($sel);
        $this->db->from('rret');
        $this->db->where('cierre', $numero);
        $this->db->group_by('tipo');
        $query = $this->db->get();
        foreach ($query->result() as $row) {
            $retiros[$row->tipo] = $row->monto;
            $totales[0] += $row->monto;
        }
        $mSQL = "SELECT TRIM(c.tipo) AS tipo,0 AS retiro,c.nombre,b.recibido,b.sistema,b.diferencia,a.caja\n\t\tFROM rcaj    AS a\n\t\tJOIN itrcaj  AS b ON a.numero=b.numero\n\t\tJOIN tarjeta AS c ON c.tipo=b.tipo\n\t\tWHERE a.numero={$dbnumero} AND c.tipo<>'RP'";
        $query = $this->db->query($mSQL);
        if ($query->num_rows() > 0) {
            $arr = array('retiro', 'recibido', 'sistema', 'diferencia');
            foreach ($query->result() as $i => $row) {
                foreach ($arr as $o => $nobj) {
                    $obj = $nobj . $row->tipo;
                    $totales[$o] += $row->{$nobj};
                    $form->{$obj} = new inputField('(' . $row->tipo . ') ' . $row->nombre, $obj);
                    $form->{$obj}->style = 'text-align:right';
                    $form->{$obj}->css_class = 'inputnum';
                    if ($nobj == 'retiro') {
                        $form->{$obj}->insertValue = isset($retiros[$row->tipo]) ? $retiros[$row->tipo] : '0';
                        $form->{$obj}->showformat = 'decimal';
                    } else {
                        $form->{$obj}->insertValue = $row->{$nobj};
                        $form->{$obj}->rule = 'numeric';
                    }
                    $form->{$obj}->size = 10;
                    $form->{$obj}->autocomplete = false;
                    if ($o != 1 || in_array($row->tipo, array('RI', 'IR'))) {
                        $form->{$obj}->readonly = true;
                        $form->{$obj}->type = 'inputhidden';
                    }
                }
            }
            foreach ($arr as $o => $nobj) {
                $obj = 't' . $nobj;
                $form->{$obj} = new inputField('<b>Totales:</b>', $obj);
                $form->{$obj}->style = 'text-align:right';
                $form->{$obj}->size = 10;
                $form->{$obj}->insertValue = $totales[$o];
                $form->{$obj}->rule = 'numeric';
                $form->{$obj}->autocomplete = false;
                if ($o == 0) {
                    $sobj = $obj;
                } else {
                    $form->{$obj}->in = $sobj;
                }
                $form->{$obj}->readonly = true;
                $form->{$obj}->type = 'inputhidden';
            }
        }
        $b_fiscal = $this->datasis->traevalor('USAMAQFISCAL', 'Activa el modo fiscal en el cierre de caja');
        if ($b_fiscal == 'S') {
            $form->x_venta = new inputField('Total Venta seg&uacute;n cierre fiscal', 'xventa');
            $form->x_venta->rule = 'max_length[17]|numeric|required';
            $form->x_venta->css_class = 'inputnum';
            $form->x_venta->size = 19;
            $form->x_venta->maxlength = 17;
            $form->x_venta->autocomplete = false;
            $form->x_viva = new inputField('Total IVA seg&uacute;n cierre fiscal', 'xviva');
            $form->x_viva->rule = 'max_length[17]|numeric|required';
            $form->x_viva->css_class = 'inputnum';
            $form->x_viva->size = 19;
            $form->x_viva->maxlength = 17;
            $form->x_viva->autocomplete = false;
            $form->x_devo = new inputField('Total de notas de cr&eacute;dito seg&uacute;n cierre fiscal', 'xdevo');
            $form->x_devo->rule = 'max_length[17]|numeric|required';
            $form->x_devo->css_class = 'inputnum';
            $form->x_devo->size = 19;
            $form->x_devo->maxlength = 17;
            $form->x_devo->autocomplete = false;
            $form->x_diva = new inputField('Total de IVA seg&uacute;n cierre fiscal', 'xdiva');
            $form->x_diva->rule = 'max_length[17]|numeric|required';
            $form->x_diva->css_class = 'inputnum';
            $form->x_diva->size = 19;
            $form->x_diva->maxlength = 17;
            $form->x_diva->autocomplete = false;
            $form->x_maqfiscal = new inputField('Serial M&aacute;quina F&iacute;scal', 'maqfiscal');
            $form->x_maqfiscal->rule = 'max_length[17]|strtoupper|required';
            $form->x_maqfiscal->size = 19;
            $form->x_maqfiscal->maxlength = 17;
            $form->x_maqfiscal->autocomplete = false;
            $form->x_ultimafc = new inputField('N&uacute;mero &uacute;ltima Factura', 'ultimafc');
            $form->x_ultimafc->rule = 'max_length[10]|required';
            $form->x_ultimafc->size = 12;
            $form->x_ultimafc->maxlength = 10;
            $form->x_ultimafc->autocomplete = false;
            $form->x_ultimanc = new inputField('N&uacute;mero &uacute;ltima NC', 'ultimanc');
            $form->x_ultimanc->rule = 'max_length[10]|required';
            $form->x_ultimanc->size = 12;
            $form->x_ultimanc->maxlength = 10;
            $form->x_ultimanc->autocomplete = false;
        }
        $form->button('btn_reg', 'Regresar', "javascript:window.location='" . site_url('ventas/rcaj/filteredgrid/search') . "'", 'BL');
        $form->submit('btnsubmit', 'Cerrar cajero');
        $form->build_form();
        $this->rapyd->jquery[] = '$(".inputnum").numeric(".");';
        $this->rapyd->jquery[] = '$(":input").click(function (){ $(this).select(); } );';
        $this->rapyd->jquery[] = '$(":input").focus(function (){ $(this).select(); } );';
        $this->rapyd->jquery[] = '$(\'input[name^="recibido"]\').bind("keyup",function() { gtotal(); });';
        $this->rapyd->jquery[] = '$(\'input[name^="recibido"]\').bind("mouseleave",function() { gtotal(); });';
        $this->rapyd->jquery[] = '$("#df1").submit(function() { return confirm("Estas seguro de realizar el Cierre?"); })';
        $this->rapyd->jquery[] = 'function gtotal(){
			TRECI=TSIS=TDIFE=0;
			$(\'input[name^="recibido"]\').each(function(i,e){
				nombre=this.name;
				tipo=nombre.substring(nombre.length-2,nombre.length);

				if($(this).val().length>0){
					recibido   =parseFloat($(this).val());
					sistema    =parseFloat($("#sistema"+tipo).val());
					diferencia=recibido-sistema;
					$("#diferencia"+tipo).val(roundNumber(diferencia,2));
					$("#diferencia"+tipo+"_val").text(nformat(diferencia,2));
				}
				if($(this).val().length>0) TRECI = TRECI+parseFloat($(this).val());
			});

			$(\'input[name^="diferencia"]\').each(function(i,e){
				if($(this).val().length>0){
					pval=parseFloat($(this).val());
					TDIFE = TDIFE+pval;
				}
			});

			$("#trecibido").val(roundNumber(TRECI,2));
			$("#tdiferencia").val(roundNumber(TDIFE,2));
			$("#trecibido_val").text(nformat(TRECI,2));
			$("#tdiferencia_val").text(nformat(TDIFE,2));
			$("#tretiro_val").text(nformat($("#tretiro").val(),2));
			$("#tsistema_val").text(nformat($("#tsistema").val(),2));
		}';
        $this->rapyd->jquery[] = 'gtotal();';
        //Cierre de caja
        if ($form->on_success()) {
            $usuario = $this->secu->usuario();
            $estampa = date('Y-m-d');
            $hora = date('H:i:s');
            $mSQL = "SELECT a.fecha,c.tipo,c.nombre ,b.recibido,b.sistema,b.diferencia, a.transac\n\t\t\tFROM rcaj    AS a\n\t\t\tJOIN itrcaj  AS b ON a.numero=b.numero\n\t\t\tJOIN tarjeta AS c ON c.tipo=b.tipo\n\t\t\tWHERE a.numero={$dbnumero}";
            $query = $this->db->query($mSQL);
            if ($query->num_rows() > 0) {
                $str = '';
                $arr = array();
                $rrecibido = $sistema = $depositos = 0;
                foreach ($query->result() as $i => $row) {
                    $nobj = 'recibido' . $row->tipo;
                    $recibido = isset($form->{$nobj}) ? empty($form->{$nobj}->newValue) ? 0.0 : floatval($form->{$nobj}->newValue) : 0.0;
                    if ($row->sistema > 0 || $recibido > 0) {
                        $str .= $row->tipo . ' ' . $recibido . '  ';
                        $arr['recibido'] = $recibido;
                        $arr['sistema'] = $row->sistema;
                        $arr['diferencia'] = $recibido - $row->sistema;
                        $arr['numero'] = $numero;
                        $arr['cierre'] = 'S';
                        $arr['tipo'] = $row->tipo;
                        if ($row->tipo == 'DE') {
                            $depositos += $recibido;
                        } else {
                            $rrecibido += $recibido;
                        }
                        $sistema += $row->sistema;
                        $mmSQL = $this->db->insert_string('itrcaj', $arr);
                        $this->db->query($mmSQL);
                    }
                }
                $rcajfecha = $this->db->escape($row->fecha);
                $transac = $row->transac;
                $arr = array('tipo' => 'F', 'recibido' => $rrecibido + $depositos, 'observa' => $str);
                if ($b_fiscal == 'S') {
                    $arr['xventa'] = $form->x_venta->newValue;
                    $arr['xviva'] = $form->x_viva->newValue;
                    $arr['xdevo'] = $form->x_devo->newValue;
                    $arr['xdiva'] = $form->x_diva->newValue;
                    $arr['maqfiscal'] = $form->x_maqfiscal->newValue;
                    $arr['ultimafc'] = $form->x_ultimafc->newValue;
                    $arr['ultimanc'] = $form->x_ultimanc->newValue;
                }
                $where = 'numero=' . $this->db->escape($numero);
                $mmSQL = $this->db->update_string('rcaj', $arr, $where);
                $this->db->query($mmSQL);
                //cierra el cajero
                $cajero = $this->datasis->dameval('SELECT cajero FROM rcaj WHERE numero=' . $dbnumero);
                $dbcajero = $this->db->escape($cajero);
                $sifact = intval($this->datasis->dameval("SELECT COUNT(*) AS cana FROM sfac WHERE cajero  ={$dbcajero} AND fecha > {$rcajfecha}"));
                $sifact += intval($this->datasis->dameval("SELECT COUNT(*) AS cana FROM sfpa WHERE cobrador={$dbcajero} AND fecha > {$rcajfecha}"));
                if ($sifact == 0) {
                    $arr = array('status' => 'C', 'fechac' => date('Ymd'), 'horac' => date('h:i:s'), 'cierre' => $rrecibido + $depositos, 'caja' => $caja);
                    $where = 'cajero=' . $this->db->escape($cajero);
                    $mmSQL = $this->db->update_string('scaj', $arr, $where);
                    $ban = $this->db->query($mmSQL);
                    if ($ban == false) {
                        memowrite($mmSQL, 'rcaj');
                    }
                }
                //Inicio de las transacciones ISLR
                $mmSQL = "SELECT a.monto,a.fecha,a.numero,c.nombre,a.transac\n\t\t\t\tFROM sfpa AS a\n\t\t\t\tJOIN rcaj AS b ON a.fecha=b.fecha AND a.cobrador=b.cajero\n\t\t\t\tJOIN scli AS c ON a.cod_cli=c.cliente\n\t\t\t\tWHERE b.numero={$dbnumero} AND a.tipo='IR'";
                $qquery = $this->db->query($mmSQL);
                foreach ($qquery->result() as $rrow) {
                    $XNUMERO = $this->datasis->fprox_numero('ndcli');
                    $data['tipo_doc'] = 'ND';
                    $data['numero'] = $XNUMERO;
                    $data['cod_cli'] = 'RETEN';
                    $data['nombre'] = 'RETENCION DE ISLR';
                    $data['fecha'] = $rrow->fecha;
                    $data['monto'] = $rrow->monto;
                    $data['impuesto'] = 0;
                    $data['vence'] = date('Ymd', mktime(0, 0, 0, substr($rrow->fecha, 5, 2) + 1, 3, substr($rrow->fecha, 0, 4)));
                    $data['observa1'] = 'RET/ISLR DE FE ' . $rrow->numero;
                    $data['observa2'] = 'CLIENTE ' . $rrow->nombre;
                    $data['banco'] = '';
                    $data['tipo_op'] = '';
                    $data['num_op'] = '';
                    $data['reten'] = 0;
                    $data['ppago'] = 0;
                    $data['control'] = '';
                    $data['cambio'] = 0;
                    $data['mora'] = 0;
                    $data['abonos'] = 0;
                    $data['transac'] = $rrow->transac;
                    $data['usuario'] = $usuario;
                    $data['estampa'] = $estampa;
                    $data['hora'] = $hora;
                    $mSQL = $this->db->insert_string('smov', $data);
                    $ban = $this->db->query($mSQL);
                    if ($ban == false) {
                        memowrite($mSQL, 'rcaj');
                    }
                }
                //Fin de las retenciones ISLR
                //Crea el movimiento en bmov
                $mSQL = 'SELECT fecha, cajero FROM rcaj WHERE numero=' . $dbnumero;
                $query = $this->db->query($mSQL);
                $row = $query->first_row();
                $fecha = $row->fecha;
                $sfecha = str_replace('', '-', $fecha);
                $cajero = $row->cajero;
                $nbmov = $this->_banprox($caja);
                $mSQL = 'SELECT moneda, numcuent,banco,saldo FROM banc WHERE codbanc= ? ';
                $query = $this->db->query($mSQL, array($caja));
                $row = $query->first_row();
                $data = array();
                $data['codbanc'] = $caja;
                $data['moneda'] = $row->moneda;
                $data['numcuent'] = $row->numcuent;
                $data['banco'] = $row->banco;
                $data['saldo'] = $row->saldo;
                $data['tipo_op'] = 'NC';
                $data['numero'] = $nbmov;
                $data['fecha'] = $fecha;
                $data['clipro'] = 'O';
                $data['codcp'] = 'VENT';
                $data['nombre'] = 'INGRESOS DIARIOS';
                $data['monto'] = $rrecibido;
                $data['concepto'] = "ENTREGA FINAL CAJERO {$cajero} DIA " . dbdate_to_human($fecha);
                $data['transac'] = $transac;
                $data['usuario'] = $usuario;
                $data['estampa'] = $estampa;
                $data['hora'] = $hora;
                $mSQL = $this->db->insert_string('bmov', $data);
                $ban = $this->db->query($mSQL);
                if ($ban == false) {
                    memowrite($mSQL, 'rcaj');
                }
                //Fin del movimiento en bmov
                //Monto por depositos
                if ($depositos > 0) {
                    $nbmov = $this->_banprox($caja);
                    $data = array();
                    $data['codbanc'] = $caja;
                    $data['moneda'] = $row->moneda;
                    $data['numcuent'] = $row->numcuent;
                    $data['banco'] = $row->banco;
                    $data['saldo'] = $row->saldo;
                    $data['tipo_op'] = 'NC';
                    $data['numero'] = $nbmov;
                    $data['fecha'] = $fecha;
                    $data['clipro'] = 'O';
                    $data['codcp'] = 'VENT';
                    $data['nombre'] = 'INGRESOS DIARIOS';
                    $data['monto'] = $depositos;
                    $data['concepto'] = "DEPOSITOS RECIBIDOS CAJERO {$cajero} DIA " . dbdate_to_human($fecha);
                    $data['transac'] = $transac;
                    $data['usuario'] = $usuario;
                    $data['estampa'] = $estampa;
                    $data['hora'] = $hora;
                    $mSQL = $this->db->insert_string('bmov', $data);
                    $ban = $this->db->query($mSQL);
                    if ($ban == false) {
                        memowrite($mSQL, 'rcaj');
                    }
                }
                //Fin del monto por deposito
                //Actualiza el saldo en la caja
                $this->datasis->actusal($caja, $sfecha, $rrecibido + $depositos);
                //Crea la diferencia en caja si la hay
                $dif = $rrecibido + $depositos - $sistema;
                if ($dif != 0.0) {
                    $mSQL = 'SELECT COUNT(*) AS n  FROM banc WHERE codbanc="DF"';
                    $query = $this->db->query($mSQL);
                    $row = $query->first_row();
                    if ($row->n == 0) {
                        $data = array();
                        $data['codbanc'] = 'DF';
                        $data['tbanco'] = 'CAJ';
                        $data['moneda'] = 'Bs';
                        $data['banco'] = 'CAJA';
                        //$data['nombre']  ='DIFERENCIA EN CAJA';
                        $data['numcuent'] = 'DIFERENCIA EN CAJA';
                        $data['activo'] = 'S';
                        $data['tipocta'] = 'C';
                        $data['saldo'] = 0;
                        $mSQL = $this->db->insert_string('banc', $data);
                        $ban = $this->db->query($mSQL);
                        if ($ban == false) {
                            memowrite($mSQL, 'rcaj');
                        }
                    }
                    $nbmov = $this->_banprox('DF');
                    $mSQL = 'SELECT moneda, numcuent,banco,saldo FROM banc WHERE codbanc="DF"';
                    $query = $this->db->query($mSQL);
                    $row = $query->first_row();
                    if ($dif < 0) {
                        // crea la NC a causa del faltante de caja
                        $data = array();
                        $data['codbanc'] = 'DF';
                        $data['moneda'] = $row->moneda;
                        $data['numcuent'] = $row->numcuent;
                        $data['banco'] = $row->banco;
                        $data['saldo'] = $row->saldo;
                        $data['tipo_op'] = 'NC';
                        $data['numero'] = $nbmov;
                        $data['fecha'] = $fecha;
                        $data['clipro'] = 'O';
                        $data['codcp'] = 'VENT';
                        $data['nombre'] = 'INGRESOS DIARIOS';
                        $data['monto'] = abs($dif);
                        $data['concepto'] = "FALTANTE EN CAJA {$caja} CAJERO {$cajero} DIA " . dbdate_to_human($fecha);
                        $data['transac'] = $transac;
                        $data['usuario'] = $usuario;
                        $data['estampa'] = $estampa;
                        $data['hora'] = $hora;
                        $mSQL = $this->db->insert_string('bmov', $data);
                        $ban = $this->db->query($mSQL);
                        if ($ban == false) {
                            memowrite($mSQL, 'rcaj');
                        }
                    } else {
                        //Crea la ND a causa del sobrante de caja
                        $data = array();
                        $data['codbanc'] = 'DF';
                        $data['moneda'] = $row->moneda;
                        $data['numcuent'] = $row->numcuent;
                        $data['banco'] = $row->banco;
                        $data['saldo'] = $row->saldo;
                        $data['tipo_op'] = 'ND';
                        $data['numero'] = $nbmov;
                        $data['fecha'] = $fecha;
                        $data['clipro'] = 'O';
                        $data['codcp'] = 'VENT';
                        $data['nombre'] = 'INGRESOS DIARIOS';
                        $data['monto'] = abs($dif);
                        $data['concepto'] = "SOBRANTE EN CAJA {$caja} CAJERO {$cajero} DIA " . dbdate_to_human($fecha);
                        $data['transac'] = $transac;
                        $data['usuario'] = $usuario;
                        $data['estampa'] = $estampa;
                        $data['hora'] = $hora;
                        $mSQL = $this->db->insert_string('bmov', $data);
                        $ban = $this->db->query($mSQL);
                        if ($ban == false) {
                            memowrite($mSQL, 'rcaj');
                        }
                    }
                    $this->datasis->actusal('DF', $sfecha, $dif);
                }
                //Crea los movimientos bmov a consecuencia de los pagos con depositos
                //$mSQL="INSERT IGNORE INTO bmov ( codbanc, tipo_op, numero, fecha, clipro, codcp, nombre, monto, concepto, status, liable, transac, usuario, estampa, hora, anulado)
                //SELECT a.banco codbanc, a.tipo tipo_op, a.num_ref numero, a.fecha, 'C' clipro, a.cod_cli codcp, b.nombre, a.monto, 'INGRESO POR COBRANZA' concepto, 'P' status, 'S' liable, a.transac, a.usuario, a.estampa, a.hora, 'N' anulado
                //FROM sfpa a JOIN scli b ON a.cod_cli=b.cliente
                //WHERE a.tipo='DE' AND tipo_doc='FE' AND fecha=${dbfecha}";
                //$ban=$this->db->query($mSQL);
                //if($ban==false) memowrite($mSQL,'rcaj');
                logusu('rcaj', "Cerro cajero {$cajero} de {$fecha}");
                redirect('ventas/rcaj/filteredgrid/search');
            }
        }
        $attr = array('class' => 'ui-state-default ui-corner-all', 'onclick' => "javascript:window.location='" . site_url('ventas/rcaj/filteredgrid/search') . "'", 'value' => 'Regresar');
        $credito = $this->datasis->dameval("SELECT SUM((a.totalg-a.inicial)*IF(a.tipo_doc='D',-1,1)) AS credito\n\t\tFROM sfac AS a\n\t\tJOIN rcaj AS b ON a.fecha=b.fecha AND b.cajero=a.cajero\n\t\tWHERE a.referen='C' AND b.numero={$dbnumero}");
        $rp = 0;
        $mSQL = "SELECT SUM(a.monto) AS rp\n\t\tFROM sfpa AS a JOIN rcaj AS b ON a.fecha=b.fecha AND a.cobrador=b.cajero\n\t\tWHERE b.numero={$dbnumero} AND a.tipo='RP'";
        $rp += $this->datasis->dameval($mSQL);
        //Toma en cuenta los cambios de cheque
        $ccheq = 0;
        $ccquery = $this->db->query("SELECT SUM(d.monto) AS monto\n\t\tFROM sfpa AS d JOIN rcaj AS b ON d.fecha=b.fecha AND d.cobrador=b.cajero\n\t\tWHERE b.numero={$dbnumero} AND d.tipo_doc = 'CC'");
        foreach ($ccquery->result() as $ccrow) {
            $ccheq += $ccrow->monto;
        }
        $cont['b_fiscal'] = $b_fiscal;
        $cont['rp'] = $rp;
        $cont['cc'] = $ccheq;
        $cont['retiros'] = $retiros;
        $cont['credito'] = empty($credito) ? 0 : $credito;
        $cont['form'] =& $form;
        $data['content'] = $this->load->view('view_rcajcierre', $cont, true);
        //$data['content'] = $form->output;
        $data['title'] = heading('Recepci&oacute;n de Caja ' . $nomcajero);
        $data['head'] = $this->rapyd->get_head() . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js') . phpscript('nformat.js');
        $this->load->view('view_ventanas', $data);
    }
Example #13
0
 function Table()
 {
     $prop = $this->propiedades;
     $res = $this->DBquery;
     //Add all columns if none was specified
     if (count($this->aCols) == 0) {
         for ($i = 0; $i < $this->DBieldsNum; $i++) {
             $this->AddCol();
         }
     }
     //Retrieve column names when not specified
     foreach ($this->aCols as $i => $col) {
         if ($col['c'] == '') {
             if (is_string($col['f'])) {
                 $this->aCols[$i]['c'] = ucfirst($col['f']);
             } else {
                 $nombre = $this->DBfieldsName[$i];
                 $this->aCols[$i]['c'] = ucfirst($nombre);
             }
         }
     }
     //Handle properties
     if (!isset($prop['width'])) {
         $prop['width'] = 0;
     }
     if ($prop['width'] == 0) {
         $prop['width'] = $this->w - $this->lMargin - $this->rMargin;
     }
     if (!isset($prop['align'])) {
         $prop['align'] = 'C';
     }
     if (!isset($prop['padding'])) {
         $prop['padding'] = $this->cMargin;
     }
     $cMargin = $this->cMargin;
     $this->cMargin = $prop['padding'];
     if (!isset($prop['HeaderColor'])) {
         $prop['HeaderColor'] = array();
     }
     $this->HeaderColor = $prop['HeaderColor'];
     if (!isset($prop['color1'])) {
         $prop['color1'] = array();
     }
     if (!isset($prop['color2'])) {
         $prop['color2'] = array();
     }
     if (!isset($prop['logo'])) {
         $this->Logo = "";
     } else {
         $this->Logo = $prop['logo'];
     }
     $this->RowColors = array($prop['color1'], $prop['color2']);
     //Compute column widths
     $this->CalcWidths($prop['width'], $prop['align']);
     //Print header
     $this->TableHeader();
     //Print rows
     $this->SetFont('Arial', '', 11);
     $this->ColorIndex = 0;
     $this->ProcessingTable = true;
     if ($this->ctotalizar) {
         foreach ($this->aCols as $i => $fila) {
             $gtotal[$fila['f']] = 0;
         }
         $rgtotal = $gtotal;
     }
     $cambio = false;
     if ($this->cgrupo) {
         foreach ($this->grupo as $fila) {
             if ($this->ctotalizar) {
                 $stotal[] = $rstotal[] = $gtotal;
             }
             $bache[$fila] = NULL;
         }
     }
     $one = $this->cgrupo;
     foreach ($res->result_array() as $row) {
         if ($one) {
             $one = false;
             foreach ($this->grupo as $fila) {
                 $bache[$fila] = $row[$fila];
             }
             $this->GroupTableHeader($row, 1);
         }
         if ($this->cgrupo) {
             $cambio = $this->grupoCambio($bache, $row);
         }
         if ($cambio) {
             foreach ($this->grupo as $fila) {
                 $bache[$fila] = $row[$fila];
             }
             if ($this->ctotalizar) {
                 for ($u = 0; $u < count($this->grupo) - ($cambio - 1); $u++) {
                     $this->Row($rstotal[$u], 'T', 0);
                     foreach ($this->aCols as $i => $fila) {
                         $stotal[$u][$fila['f']] = 0;
                     }
                 }
             } else {
                 $this->line();
             }
             $this->ln(3);
             $this->GroupTableHeader($row, $cambio);
             $cambio = false;
         }
         foreach ($this->aCols as $i => $fila) {
             $key = $fila['f'];
             if ($this->ctotalizar) {
                 if (in_array($key, $this->totalizar)) {
                     $gtotal[$key] += $row[$key];
                     if ($this->cgrupo) {
                         for ($u = 0; $u < count($this->grupo); $u++) {
                             $stotal[$u][$key] += $row[$key];
                             $rstotal[$u][$key] = number_format($stotal[$u][$key], 2, ',', '.');
                         }
                     }
                     $rgtotal[$key] = number_format($gtotal[$key], 2, ',', '.');
                 } else {
                     $total[$key] = $gtotal[$key] = $rtotal[$key] = $rgtotal[$key] = ' ';
                     for ($u = 0; $u < count($this->grupo); $u++) {
                         $stotal[$u][$key] = $rstotal[$u][$key] = ' ';
                     }
                 }
             }
             if ($this->DBfieldsType[$key] == 'real') {
                 $row[$key] = number_format($row[$key], 2, ',', '.');
             } elseif ($this->DBfieldsType[$key] == 'date') {
                 $row[$key] = dbdate_to_human($row[$key]);
             }
         }
         $this->Row($row);
     }
     if ($this->ctotalizar) {
         if ($this->cgrupo) {
             for ($u = 0; $u < count($this->grupo); $u++) {
                 $this->Row($rstotal[$u], 'T', 0);
                 foreach ($this->aCols as $i => $fila) {
                     $stotal[$u][$fila['f']] = 0;
                 }
             }
         }
         $this->ln();
         $this->Row($rgtotal, 'T', 0);
     } else {
         $this->ln(5);
     }
     $this->ProcessingTable = false;
     $this->cMargin = $cMargin;
     $this->aCols = array();
 }
Example #14
0
    function build()
    {
        $this->_getValue();
        $output = '';
        rapydlib('jscalendar');
        if (!isset($this->size)) {
            $this->size = 25;
        }
        switch ($this->status) {
            case 'show':
                if (!isset($this->value)) {
                    $value = RAPYD_FIELD_SYMBOL_NULL;
                } elseif ($this->value == '') {
                    $value = '';
                } else {
                    $value = dbdate_to_human($this->value, $this->format);
                }
                $output = $value;
                break;
            case 'create':
            case 'modify':
                $value = '';
                //jscalendar integration
                if ($this->value != '') {
                    if ($this->is_refill) {
                        $value = $this->value;
                    } else {
                        $value = dbdate_to_human($this->value, $this->format);
                    }
                }
                $attributes = array('name' => $this->name, 'id' => $this->name, 'value' => $value, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
                if (strlen($this->title) > 0) {
                    $attributes['title'] = $this->title;
                }
                if ($this->readonly) {
                    $attributes['readonly'] = 'readonly';
                }
                if ($this->type == 'inputhidden') {
                    $attributes['type'] = 'hidden';
                    $this->calendar = false;
                }
                $output = form_input($attributes);
                if ($this->type == 'inputhidden') {
                    $output = "<span id='" . $this->name . "_val'>{$value}</span>" . $output;
                }
                if ($this->calendar) {
                    $output .= ' <img src="' . RAPYD_LIBRARIES . 'jscalendar/calender_icon.gif" id="' . $this->name . '_button" border="0" style="vertical-align:middle;" />' . $this->extra_output;
                    $output .= HTML::javascriptTag('
					 Calendar.setup({
					inputField  : "' . $this->name . '",
					ifFormat    : "' . datestamp_from_format($this->format) . '",
					button      : "' . $this->name . '_button",
					align       : "Bl",
					singleClick : false,
					mondayFirst : true,
					weekNumbers : false
				 });');
                }
                break;
            case 'disabled':
                //versione encoded
                $output = dbdate_to_human($this->value, $this->format);
                break;
            case 'hidden':
                $output = form_hidden($this->name, $this->value);
                break;
            default:
        }
        $this->output = $output;
    }
Example #15
0
		$("[id^='tr_itccli_']").each(function(){
			nom=this.id;
			pos=this.id.lastIndexOf('_');
			if(pos>0){
				ind = this.id.substring(pos+1);

				nnumero= $("#numero_"+ind).val();
				ntipo  = $("#tipo_doc_"+ind).val();

				if(nnumero==numero && ntipo==tipo){
					$('#abono_'+ind).focus();
					if(pago=='CH'){
						$('#tipo_0').val('CH');
						$('#sfpafecha_0').val('<?php 
echo dbdate_to_human(date('Y-m-d'));
?>
');
						$('#num_ref_0').focus();
					}
				}else{
					//$('#tr_itccli_'+ind).remove();
				}
			}
		});
	});
}
</script>
<input type="hidden" id="sselcli" >
<div style='text-align:center;background-color:#E4E4E4' class='ui-corner-all'>
<?php 
Example #16
0
 function resumen()
 {
     $this->rapyd->load('datagrid2', 'datafilter', 'datatable');
     $form = new DataForm("finanzas/resumendiario/resumen/process");
     $form->fecha = new dateonlyField("Fecha", "fecha");
     $form->fecha->insertValue = date("Y-m-d");
     $form->fecha->rule = "required|chfecha";
     $form->fecha->size = 12;
     $form->submit("btnsubmit", "Consultar");
     $form->build_form();
     if ($form->on_success()) {
         $this->fecha = $form->fecha->newValue;
     }
     $dbfecha = $this->db->escape($this->fecha);
     //***********************************
     //      RESUMEN DE CAJAS (RCAJ)
     //***********************************
     $grid = new DataGrid2("Resumen de Cajas");
     $grid->db->select(array("cajero", "ingreso AS venta", "recibido", "(ingreso - recibido) AS diferencia"));
     $grid->db->from("rcaj");
     $grid->db->where("fecha", $this->fecha);
     $grid->order_by("caja", "asc");
     //$grid->per_page = 15;
     $grid->column('Caja', 'cajero', "align='center'");
     $grid->column('Venta', '<nformat><#venta#></nformat>', "align='right'");
     $grid->column('Recibido', '<nformat><#recibido#></nformat>', "align='right'");
     $grid->column('Diferencia', '<nformat><#diferencia#></nformat>', "align='right'");
     $grid->totalizar("venta", "recibido", "diferencia");
     $grid->build();
     //***********************************
     //DISTRIBUCION DE LA COBRANZA (SFPA)
     //***********************************
     $grid2 = new DataGrid2('Distribuci&oacute;n de la cobranza');
     $grid2->db->select(array('a.tipo', 'b.nombre', 'sum(a.monto) AS monto', 'COUNT(*) AS cantidad'));
     $grid2->db->from('sfpa a');
     $grid2->db->join('tarjeta b', 'a.tipo=b.tipo');
     $grid2->db->where('f_factura', $this->fecha);
     $grid2->db->groupby('a.tipo');
     $grid2->order_by('a.tipo', 'asc');
     //$grid2->per_page = 15;
     $grid2->column('Tipo', '(<#tipo#>) <#nombre#>', "align='left'");
     $grid2->column('Cantidad', 'cantidad', "align='right'");
     $grid2->column('Monto', '<nformat><#monto#></nformat>', "align='right'");
     $grid2->totalizar('monto');
     $grid2->build();
     //***********************************
     //      VENTAS Y DEVOLUCIONES
     //***********************************
     function vdnom($tipo_doc, $referen)
     {
         $nombre = $tipo_doc == 'D' ? 'Devoluciones ' : 'Ventas ';
         $nombre .= $referen == 'E' ? 'al Contado' : 'a Credito';
         return $nombre;
     }
     $grid3 = new DataGrid2("Distribuci&oacute;n de la cobranza");
     $grid3->db->select(array('tipo_doc', 'referen', 'COUNT(*) AS cana', 'SUM(totals)*IF(tipo_doc = "D" ,-1,1) AS monto'));
     $grid3->db->from("sfac a");
     $grid3->db->where('referen <>', 'P');
     $grid3->db->where('fecha', $this->fecha);
     $grid3->db->groupby('tipo_doc');
     $grid3->db->groupby('referen');
     $grid3->use_function('vdnom');
     $grid3->column('Tipo', '<vdnom><#tipo_doc#>|<#referen#></vdnom>', "align='left'");
     $grid3->column('Cantidad', '<nformat><#cana#>|0</nformat>', "align='right'");
     $grid3->column('Monto', '<nformat><#monto#></nformat>', "align='right'");
     $grid3->totalizar('monto');
     $grid3->build();
     //***********************************
     //   RESUMEN DE VENTAS
     //***********************************
     $udia = days_in_month(substr($this->fecha, 4, 2), substr($this->fecha, 0, 4));
     $fdesde = substr($this->fecha, 0, 6) . '01';
     $fhasta = substr($this->fecha, 0, 6) . $udia;
     $ano = substr($this->fecha, 0, 4);
     $row1 = $this->datasis->damerow("SELECT COUNT(*) AS a,SUM(totals*(IF(tipo_doc = 'F',1,-1))) AS b FROM sfac WHERE tipo_doc <>'X' AND YEAR(fecha) = {$ano} AND fecha < {$dbfecha}");
     $row2 = $this->datasis->damerow("SELECT COUNT(*) AS a,SUM(totals*(IF(tipo_doc = 'F',1,-1))) AS b FROM sfac WHERE tipo_doc <>'X' AND fecha BETWEEN {$fdesde} AND {$fhasta}");
     $row3 = $this->datasis->damerow("SELECT COUNT(*) AS a,SUM(totals*(IF(tipo_doc = 'F',1,-1))) AS b FROM sfac WHERE tipo_doc <>'X' AND fecha = {$dbfecha}");
     $cost1 = $this->datasis->dameval("SELECT SUM(costo*cana*(IF(tipoa = 'F',1,-1))) AS a FROM sitems WHERE tipoa <>'X' AND YEAR(fecha) = {$ano} AND fecha < {$dbfecha}");
     $cost2 = $this->datasis->dameval("SELECT SUM(costo*cana*(IF(tipoa = 'F',1,-1))) AS a FROM sitems WHERE tipoa <>'X' AND fecha BETWEEN {$fdesde} AND {$dbfecha}");
     $cost3 = $this->datasis->dameval("SELECT SUM(costo*cana*(IF(tipoa = 'F',1,-1))) AS a FROM sitems WHERE tipoa <>'X' AND fecha = {$dbfecha}");
     if (empty($row1)) {
         $row1 = array('a' => 0, 'b' => 0);
     }
     if (empty($row2)) {
         $row2 = array('a' => 0, 'b' => 0);
     }
     if (empty($row3)) {
         $row3 = array('a' => 0, 'b' => 0);
     }
     $row1['c'] = $cost1;
     $row2['c'] = $cost2;
     $row3['c'] = $cost3;
     $rdata[0] = array('a' => $row1['a'], 'b' => $row1['b'], 'c' => $row1['c'], 'd' => $row1['b'] - $row1['c'], 'razon' => 'Ventas en lo que va de año');
     $rdata[1] = array('a' => $row2['a'], 'b' => $row2['b'], 'c' => $row2['c'], 'd' => $row2['b'] - $row2['c'], 'razon' => 'Ventas en lo que va de mes');
     $rdata[2] = array('a' => $row3['a'], 'b' => $row3['b'], 'c' => $row3['c'], 'd' => $row3['b'] - $row3['c'], 'razon' => 'Ventas de hoy');
     $grid8 = new DataGrid("Resumen de Ventas " . $this->fecha, $rdata);
     $grid8->column("Raz&oacute;n", "razon");
     $grid8->column("Cantidad", "a", "align='right'");
     $grid8->column("Costo", "<nformat><#c#></nformat>", "align='right'");
     $grid8->column("Monto", "<nformat><#b#></nformat>", "align='right'");
     $grid8->column("Margen", "<nformat><#d#></nformat>", "align='right'");
     $grid8->build();
     $rdata = array();
     //***********************************
     //   CUENTAS POR COBRAR (smov)
     //***********************************
     $grid4 = new DataGrid2('Cuentas por Cobrar');
     $grid4->db->select(array("c.gr_desc grupo", "SUM((a.monto-a.abonos)*IF(tipo_doc='AN',-1,1))saldo"));
     $grid4->db->from('smov a');
     $grid4->db->join('scli b', 'a.cod_cli = b.cliente');
     $grid4->db->join('grcl c', 'b.grupo = c.grupo');
     $grid4->db->where("a.tipo_doc IN ('FC','ND','GI','AN')");
     $grid4->db->groupby('c.gr_desc');
     $grid4->order_by("c.gr_desc", "asc");
     //$grid4->per_page = 15;
     $grid4->column('Grupo de Clientes', 'grupo', "align='left'");
     $grid4->column('Monto', '<nformat><#saldo#></nformat>', "align='right'");
     $grid4->totalizar('saldo');
     $grid4->build();
     //***********************************
     //            GASTOS
     //***********************************
     $row = $this->datasis->dameval("SELECT SUM(montotot) AS a FROM scst WHERE tipo_doc = 'FC' AND recep = {$dbfecha}");
     $row2 = $this->datasis->dameval("SELECT SUM(totbruto) AS a FROM gser WHERE tipo_doc = 'FC' AND fecha = {$dbfecha}");
     $rdata[0] = array('nombre' => 'Total de Compras', 'monto' => $row);
     $rdata[1] = array('nombre' => 'Total de Gastos', 'monto' => $row2);
     $grid7 = new DataGrid2('Total Compras y Gastos de Hoy', $rdata);
     $grid7->column('Raz&oacute;n', 'nombre');
     $grid7->column('Monto', '<nformat><#monto#></nformat>', "align='right'");
     $grid7->totalizar('monto');
     $grid7->build();
     //***********************************
     //   CUENTAS POR PAGAR (sprm)
     //***********************************
     $grid5 = new DataGrid2('Cuentas por Pagar');
     $grid5->db->select(array('c.gr_desc grupo', "SUM((a.monto-a.abonos)*IF(tipo_doc = 'AN',-1,1)) saldo"));
     $grid5->db->from('sprm a');
     $grid5->db->join('sprv b', 'a.cod_prv = b.proveed');
     $grid5->db->join('grpr c', 'b.grupo = c.grupo');
     $grid5->db->where("a.tipo_doc IN ('FC','ND','GI','AN')");
     $grid5->db->groupby('c.gr_desc');
     $grid5->order_by('c.gr_desc', 'asc');
     //$grid5->per_page = 15;
     $grid5->column('Grupo de Proveedoores', 'grupo', "align='left'");
     $grid5->column('Monto', '<nformat><#saldo#></nformat>', "align='right'");
     $grid5->totalizar('saldo');
     $grid5->build();
     //***********************************
     //   PROMEDIO INVENTARIO (sinv)
     //***********************************
     $grid6 = new DataGrid2('Total de Inventario');
     $grid6->db->select(array('d.descrip AS descrip', 'SUM(a.pond*a.existen) AS suma'));
     $grid6->db->from('sinv a');
     $grid6->db->join('grup b ', 'a.grupo = b.grupo');
     $grid6->db->join('line c ', 'b.linea = c.linea');
     $grid6->db->join('dpto d ', 'd.depto = c.depto');
     $grid6->db->groupby('c.depto');
     $grid6->db->order_by('d.descrip');
     //$grid6->per_page = 15;
     $grid6->column('Departamento', 'descrip', "align='left'");
     $grid6->column('Monto', '<nformat><#suma#></nformat>', "align='right'");
     $grid6->totalizar('suma');
     $grid6->build();
     $data['rcaj'] = $grid->output;
     $data['sfpa'] = $grid2->output;
     $data['tot'] = $grid3->output;
     $data['resven'] = $grid8->output;
     $data['smov'] = $grid4->output;
     $data['scstgser'] = $grid7->output;
     $data['sprm'] = $grid5->output;
     $data['sinv'] = $grid6->output;
     $data0['content'] = $form->output . $this->load->view('view_resumendiario', $data, TRUE);
     $data0['head'] = $this->rapyd->get_head();
     $data0['title'] = "<h1>" . $this->t**s . " para la fecha " . dbdate_to_human($this->fecha) . "</h1>";
     $this->load->view('view_ventanas', $data0);
 }
Example #17
0
 function asignar($fechad, $fechah, $codbanc, $concilia = '')
 {
     $this->rapyd->load("datagrid", "dataobject", "fields");
     function asigna($id, $value = "N", $anulado = "N")
     {
         if ($anulado != "S") {
             $campo = new dropdownField("Title", "gt[{$id}]");
             $campo->status = "modify";
             $campo->option("S", "conciliado");
             $campo->option("N", "Sin conciliar");
             $campo->value = $value;
             $campo->style = "width:100px";
             $campo->build();
             return $campo->output;
         } else {
             return 'Anulado';
         }
     }
     $tabla = form_open($this->url . "carga/");
     $ddata = array('fechad' => $fechad, 'fechah' => $fechah, 'codbanc' => $codbanc);
     if (!empty($concilia)) {
         $ddata['concilia'] = $concilia;
     }
     $grid = new DataGrid("Conciliaci&oacute;n desde " . dbdate_to_human($fechad) . " hasta " . dbdate_to_human($fechah));
     $grid->db->select(array("id", "cheque", "MID(observa,1,80) observa", "fecha", "fechapago", "monto", "concilia", "fconcilia", "anulado", "IF(tipo_doc='CH','CHEQUE',IF(tipo_doc='NC','N. CREDITO', IF(tipo_doc='ND','N. DEBITO', IF(tipo_doc='DP','DEPOSITO','')))) tipo"));
     $grid->db->from('mbanc');
     if (!empty($codbanc)) {
         $grid->db->where("codbanc = ", $codbanc);
     }
     if (!empty($concilia)) {
         $grid->db->where("concilia = ", $concilia);
     }
     $grid->db->where("fecha >= ", $fechad);
     $grid->db->where("fecha <= ", $fechah);
     $grid->use_function('asigna');
     $grid->column("Tipo Transaccion", "tipo", 'align=left');
     $grid->column("Nro. Transaccion", "cheque", 'align=left');
     $grid->column("Fecha Transaccion", "<dbdate_to_human><#fecha#></dbdate_to_human>", "align='center'");
     //$grid->column("Fecha Concilia","<dbdate_to_human><#fconcilia#></dbdate_to_human>" ,"align='center'");
     $grid->column("Concepto", "observa", 'align=left');
     $grid->column("Monto", "<number_format><#monto#>|2|,|.</number_format>", "align='right'");
     $grid->column("Verificado", "<asigna><#id#>|<#concilia#>|<#anulado#></asigna>", "align='right'");
     $grid->build();
     //echo $grid->db->last_query();
     $tabla .= $salida = anchor($this->url . 'sel', 'Regresar');
     $tabla .= $grid->output . form_submit('mysubmit', 'Guardar') . form_hidden($ddata);
     $tabla .= form_close();
     if ($grid->recordCount == 0) {
         $tabla = 'No hay registros para esta selecci&oacute;n';
     }
     $data['content'] = $tabla;
     $data['title'] = "Conciliaci&oacute;n";
     $data["head"] = $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
Example #18
0
 function build()
 {
     $this->_getValue();
     $output = "";
     rapydlib("jscalendar");
     if (!isset($this->size)) {
         $this->size = 25;
     }
     switch ($this->status) {
         case "show":
             if (!isset($this->value)) {
                 $value = RAPYD_FIELD_SYMBOL_NULL;
             } elseif ($this->value == "") {
                 $value = "";
             } else {
                 $value = dbdate_to_human($this->value, $this->format);
             }
             $output = $value;
             break;
         case "create":
         case "modify":
             $value = "";
             //jscalendar integration
             if ($this->value != "") {
                 if ($this->is_refill) {
                     $value = $this->value;
                 } else {
                     $value = dbdate_to_human($this->value, $this->format);
                 }
             }
             $attributes = array('name' => $this->name, 'id' => $this->name, 'value' => $value, 'size' => $this->size, 'onclick' => $this->onclick, 'onchange' => $this->onchange, 'class' => $this->css_class, 'style' => $this->style);
             if ($this->readonly) {
                 $attributes['readonly'] = 'readonly';
             }
             $output = form_input($attributes);
             //'<div>'.
             $output .= ' <img src="' . RAPYD_LIBRARIES . 'jscalendar/calender_icon.gif" id="' . $this->name . '_button" border="0" style="vertical-align:middle;" />' . $this->extra_output;
             $output .= $this->html->javascriptTag('
      Calendar.setup({
     inputField  : "' . $this->name . '",
     ifFormat    : "' . datestamp_from_format($this->format) . '",
     button      : "' . $this->name . '_button",
     align       : "Bl",
     singleClick : false,
     mondayFirst : true,
     weekNumbers : false
    });');
             break;
         case "disabled":
             //versione encoded
             $output = dbdate_to_human($this->value, $this->format);
             break;
         case "hidden":
             $output = form_hidden($this->name, $this->value);
             break;
         default:
     }
     $this->output = $output;
 }
Example #19
0
 function masspros()
 {
     //$this->genesal=false;
     $rt = array('status' => 'B', 'mensaje' => '', 'caub' => array());
     $propos = $_POST;
     $arrind = array();
     if (!$this->datasis->sidapuede('STRA', 'INCLUIR%')) {
         $rt['mensaje'] = 'No tiene privilegios para realizar esta operacion';
         echo json_encode($rt);
         return false;
     }
     if (isset($propos['caub'])) {
         if (!is_array($propos['caub']) && count($propos['caub']) > 0) {
             $rt['mensaje'] = 'No ha seleccionado almacenes';
             echo json_encode($rt);
             return false;
         }
     } else {
         $rt['mensaje'] = 'No ha seleccionado almacenes';
         echo json_encode($rt);
         return false;
     }
     $can = 0;
     $keys = array_keys($propos);
     foreach ($keys as $val) {
         if (preg_match('/^codigo_(?P<ind>\\d+)/', $val, $matches)) {
             if (!empty($propos[$val])) {
                 $arrind[] = $matches['ind'];
                 $can++;
             }
         }
     }
     if ($can == 0) {
         $rt['mensaje'] = 'No hay productos';
         echo json_encode($rt);
         return false;
     }
     $rt['status'] = 'A';
     $fecha = dbdate_to_human(date('Y-m-d'));
     foreach ($propos['caub'] as $recibe) {
         $_POST = array();
         $_POST['envia'] = $propos['envia'];
         $_POST['fecha'] = $fecha;
         $_POST['observ1'] = 'Transferencia en lotes';
         $_POST['recibe'] = $recibe;
         $can = 0;
         foreach ($arrind as $i) {
             $cnd = "{$recibe}_{$i}";
             $ind = "codigo_{$i}";
             if (isset($propos[$ind]) && isset($propos[$cnd])) {
                 $cana = floatval($propos[$cnd]);
                 if (!empty($propos[$ind]) && $cana > 0) {
                     $_POST[$ind] = $propos[$ind];
                     $ind = 'cantidad_' . $i;
                     $_POST[$ind] = $cana;
                     $ind = 'descrip_' . $i;
                     if (isset($propos[$ind])) {
                         $_POST[$ind] = $propos[$ind];
                     }
                     $can++;
                 }
             }
         }
         if ($can > 0) {
             ob_start();
             $this->dataedit();
             $sal = ob_get_contents();
             @ob_end_clean();
             $jsal = json_decode($sal);
             if ($jsal->status == 'B') {
                 $rt['status'] = 'B';
                 $rt['mensaje'] .= 'Problemas al transferir al almacen ' . $recibe . ': ' . $jsal->mensaje;
             } else {
                 $rt['caub'][] = $recibe;
             }
             $this->chrepetidos = array();
             $this->validation->clean();
         }
     }
     echo json_encode($rt);
     return true;
 }
Example #20
0
</td>
				</tr>
				<tr>
					<td style="font-size:18pt;" align='left'>
						<?php 
$chexisten = $this->datasis->traevalor('CONSULTAEXIST', 'Muestra la existencia en el modulo de consultas');
if ($chexisten == 'S') {
    ?>
							<b>Existencia:</b> <?php 
    echo $existen;
    ?>
						<?php 
}
?>
						</td>
					<td style="font-size:14pt;" align='left'><b>Fecha:</b> <?php 
echo substr(dbdate_to_human($fecha), 3, 8);
?>
</td>
				</tr>
			</table>
		</td>
	</tr>
	<?php 
if (isset($img)) {
    echo "<tr><td align='center'>{$img}</td></tr>";
}
?>
<table>
</p>
Example #21
0
 function grafico($codigo = '', $mes = '', $anio = '')
 {
     $this->load->library('Graph');
     if (empty($mes) and empty($anio)) {
         return;
     }
     $fechad = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechah = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $mSQL = "SELECT DATE_FORMAT(fecha, '%d')as fecha, codigo, sum(cantidad) cantidad, IF(sum(cantidad)<=salcant,sum(cantidad),salcant)*(salcant>0)as salcant \n\t\tFROM costos \n\t\tWHERE codigo='{$codigo}' AND fecha>='{$fechad}' AND fecha<='{$fechah}' AND origen='3I'\n\t\tGROUP BY fecha HAVING cantidad>0";
     echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->cantidad > $maxval) {
             $maxval = $row->cantidad;
         }
         $fecha[] = $row->fecha;
         $codigo = $row->codigo;
         $data_1[] = $row->cantidad;
         $data_2[] = $row->salcant;
     }
     $fechadd = dbdate_to_human($fechad);
     $fechahh = dbdate_to_human($fechah);
     $nombre = $this->datasis->dameval("SELECT descrip FROM sinv WHERE codigo='{$codigo}'");
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar_glass(55, '#D54C78', '#C31812');
     $bar_1->key('Ventas', 10);
     $bar_2 = new line_dot(3, 5, '#0066CC', 'Downloads', 10);
     $bar_2->key('Existencias', 10);
     for ($i = 0; $i < count($data_1); $i++) {
         $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.')));
         $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.')));
         //  $bar_1->links[]= site_url("/inventario/gproductos/mensuales/$anio/".str_replace('/',':slach:',$proveed[$i]));
         //  $bar_1->links[]= site_url("/inventario/gproductos/mensuales/$anio/".raencode($proveed[$i]));
     }
     $g = new graph();
     $g->set_is_decimal_separator_comma(1);
     if ($maxval > 0) {
         $g->title('Grafico de ' . $nombre . ' Desde ' . $fechadd . ' Hasta ' . $fechahh, '{font-size: 16px; color:#0F3054}');
         $g->data_sets[] = $bar_1;
         $g->data_sets[] = $bar_2;
         $g->set_x_labels($fecha);
         $g->set_x_label_style(10, '#000000', 2, 1);
         $g->set_x_axis_steps(10);
         $g->set_x_legend('Fecha', 14, '#004381');
         $g->bg_colour = '#FFFFFF';
         $g->set_tool_tip('#key#<br>Fecha: #x_label# <br>Cantidad: #tip#');
         $g->set_y_max(ceil($maxval / $om));
         $g->y_label_steps(5);
         //$g->set_y_legend('Ventas x '.number_format($om,0,'','.').' (Bs)', 16, '#004381' );
     } else {
         $g->title('No existen datos con la informacion seleccionada', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
Example #22
0
 function _pre_delete($do)
 {
     $fecha = $do->get('fecha');
     $dbfecha = $this->db->escape($fecha);
     $cana = $this->datasis->dameval("SELECT COUNT(*) AS cana FROM lcierre WHERE fecha=" . $dbfecha);
     if ($cana > 0) {
         $do->error_message_ar['pre_del'] = $do->error_message_ar['delete'] = 'Ya el d&iacute;a ' . dbdate_to_human($fecha) . ' fue cerrado.';
         return false;
     }
     return true;
 }
Example #23
0
 function chfecha($fecha)
 {
     return true;
     $date = DateTime::createFromFormat('d/m/Y', $fecha);
     $fecha = $date->format('Ymd');
     $now = date('Ymd', now());
     if ($fecha > $now) {
         $this->validation->set_message('chfecha', "La fecha es incorrecta, No es V�lida una Fecha Futura. </br>La fecha del servidor es:" . dbdate_to_human($now));
         return false;
     }
     $f = $this->datasis->dameval("SELECT fecha FROM otrabajo WHERE fecha >{$fecha} ORDER BY fecha DESC LIMIT 1");
     if (!empty($f)) {
         $this->validation->set_message('chfecha', "La fecha es incorrecta, debe ser mayor o igual a " . dbdate_to_human($f));
         return false;
     }
 }
Example #24
0
 function dataedit()
 {
     $this->rapyd->load('datadetails', 'dataobject');
     $this->load->helper('form');
     $mBANC = array('tabla' => 'banc', 'columnas' => array('codbanc' => 'C&oacute;odigo', 'banco' => 'Banco', 'numcuent' => 'Cuenta', 'saldo' => 'Saldo'), 'filtro' => array('codbanc' => 'C&oacute;odigo', 'banco' => 'Banco', 'numcuent' => 'Cuenta', 'saldo' => 'Saldo'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('codbanc' => 'codbanc_<#i#>'), 'where' => 'activo = "S" ', 'titulo' => 'Buscar Bancos');
     $bBANC = $this->datasis->p_modbus($mBANC, "<#i#>");
     $mRECIBO = array('tabla' => 'recibo', 'columnas' => array('id' => 'Ref.', 'numero' => 'Numero', 'fecha' => 'Fecha', 'monto' => 'Monto', 'rifci' => 'RIF/CI', 'nombre' => 'Nombre', 'observa' => 'Observa'), 'filtro' => array('id' => 'Ref.', 'numero' => 'Numero', 'fecha' => 'Fecha', 'monto' => 'Monto', 'rifci' => 'RIF/CI', 'nombre' => 'Nombre', 'observa' => 'Observa'), 'p_uri' => array(4 => '<#i#>'), 'retornar' => array('id' => 'recibo_<#i#>', 'numero' => 'numerop_<#i#>', 'DATE_FORMAT(fecha,"%d/%m/%Y")' => 'fechap_<#i#>', 'monto' => 'montop_<#i#>', 'nombre' => 'nombrep_<#i#>', 'observa' => 'observap_<#i#>'), 'where' => 'status = "P" ', 'script' => array('cal_totr()'), 'titulo' => 'Buscar Recibos por Pagar');
     $bRECIBO = $this->datasis->p_modbus($mRECIBO, "<#i#>");
     $do = new DataObject("abonos");
     $do->rel_one_to_many('itabonos', 'itabonos', array('id' => 'abono'));
     $do->rel_one_to_many('sfpa', 'sfpa', array('id' => 'abono'));
     $do->rel_pointer('itabonos', 'recibo', 'itabonos.recibo=recibo.id', 'recibo.numero AS numerop,recibo.fecha AS fechap,recibo.monto AS montop,recibo.observa AS observap,recibo.tipo AS tipop,recibo.nombre AS nombrep,recibo.id AS idp', 'LEFT');
     $edit = new DataDetails($this->t**s, $do);
     $edit->back_url = site_url($this->url . "filteredgrid");
     $edit->set_rel_title('itabonos', 'Rubro <#o#>');
     $edit->set_rel_title('sfpa', 'Rubro <#o#>');
     $edit->back_url = site_url($this->url . "filteredgrid");
     $edit->pre_process('insert', '_valida');
     $edit->pre_process('update', '_valida');
     $edit->post_process('insert', '_post_insert');
     $edit->post_process('update', '_post_update');
     $edit->post_process('delete', '_post_delete');
     $edit->id = new inputField('id', 'id');
     $edit->id->rule = 'max_length[11]';
     $edit->id->size = 13;
     $edit->id->maxlength = 11;
     $edit->id->mode = 'autohide';
     $edit->id->when = array('show', 'modify');
     $edit->totr = new inputField("Total Recibos", 'totr');
     $edit->totr->size = 10;
     $edit->totr->readonly = true;
     $edit->totr->css_class = 'inputnum';
     $edit->totb = new inputField("Total Bancos", 'totb');
     $edit->totb->size = 10;
     $edit->totb->readonly = true;
     $edit->totb->css_class = 'inputnum';
     $edit->estampa = new autoUpdateField('estampa', date('Ymd'), date('Ymd'));
     /******** RECIBOS *************/
     $edit->itrecibo = new inputField("(<#o#>) Ref. Recibo", 'recibo_<#i#>');
     $edit->itrecibo->db_name = 'recibo';
     $edit->itrecibo->size = 5;
     $edit->itrecibo->rel_id = 'itabonos';
     $edit->itrecibo->readonly = true;
     $edit->itrecibo->append($bRECIBO);
     $edit->itnumerop = new inputField("(<#o#>) Numero", 'numerop_<#i#>');
     $edit->itnumerop->db_name = 'numerop';
     $edit->itnumerop->size = 10;
     $edit->itnumerop->rel_id = 'itabonos';
     $edit->itnumerop->pointer = true;
     $edit->itnumerop->readonly = true;
     $edit->itfechap = new inputField("(<#o#>) Fecha", 'fechap_<#i#>');
     $edit->itfechap->db_name = 'fechap';
     $edit->itfechap->size = 10;
     $edit->itfechap->rel_id = 'itabonos';
     $edit->itfechap->pointer = true;
     $edit->itfechap->readonly = true;
     $edit->itmontop = new inputField("(<#o#>) Monto", 'montop_<#i#>');
     $edit->itmontop->db_name = 'montop';
     $edit->itmontop->size = 10;
     $edit->itmontop->rel_id = 'itabonos';
     $edit->itmontop->pointer = true;
     $edit->itmontop->readonly = true;
     $edit->itmontop->value = 0;
     $edit->itnombrep = new inputField("(<#o#>) Nombre", 'nombrep_<#i#>');
     $edit->itnombrep->db_name = 'nombrep';
     $edit->itnombrep->size = 20;
     $edit->itnombrep->rel_id = 'itabonos';
     $edit->itnombrep->pointer = true;
     $edit->itnombrep->readonly = true;
     $edit->itobservap = new inputField("(<#o#>) Observaci&oacute;n", 'observap_<#i#>');
     $edit->itobservap->db_name = 'observap';
     $edit->itobservap->size = 30;
     $edit->itobservap->rel_id = 'itabonos';
     $edit->itobservap->pointer = true;
     $edit->itobservap->readonly = true;
     /****** CHEQUES *********************/
     $edit->itcodbanc = new inputField("(<#o#>) Banco", 'codbanc_<#i#>');
     $edit->itcodbanc->db_name = 'codbanc';
     $edit->itcodbanc->size = 4;
     $edit->itcodbanc->rel_id = 'sfpa';
     $edit->itcodbanc->rule = "required|callback_banco";
     $edit->itcodbanc->append($bBANC);
     $edit->itcodbanc->value = $this->datasis->traevalor('ABONOCODBANCDEFECTO');
     $edit->ittipo_doc = new dropdownField("(<#o#>) Tipo Documento", "tipo_doc_<#i#>");
     $edit->ittipo_doc->db_name = 'tipo_doc';
     $edit->ittipo_doc->rel_id = 'sfpa';
     $edit->ittipo_doc->style = "width:130px;";
     if ($this->datasis->traevalor('ABONOS_EF_DEFECTO') == 'S') {
         $edit->ittipo_doc->option("EF", "Efectivo");
         $edit->ittipo_doc->option("DP", "Deposito");
         $edit->ittipo_doc->option("DB", "Tarjeta D&eacute;bito");
         $edit->ittipo_doc->option("DF", "Diferencia");
     } else {
         $edit->ittipo_doc->option("DP", "Deposito");
         $edit->ittipo_doc->option("DB", "Tarjeta D&eacute;bito");
         $edit->ittipo_doc->option("DF", "Diferencia");
         $edit->ittipo_doc->option("EF", "Efectivo");
     }
     $edit->itcheque = new inputField("(<#o#>) Transacci&oacute;n", 'cheque_<#i#>');
     $edit->itcheque->db_name = 'cheque';
     $edit->itcheque->size = 20;
     $edit->itcheque->rel_id = 'sfpa';
     $edit->itfecha = new dateonlyField("(<#o#>) Fecha Cheque", "fecha_<#i#>");
     $edit->itfecha->db_name = 'fecha';
     $edit->itfecha->size = 10;
     $edit->itfecha->rel_id = 'sfpa';
     $edit->itfecha->insertValue = date('Ymd');
     $edit->itfecha->rule = 'required';
     $edit->itmonto = new inputField("(<#o#>) Total", 'monto_<#i#>');
     $edit->itmonto->db_name = 'monto';
     $edit->itmonto->size = 10;
     $edit->itmonto->rel_id = 'sfpa';
     //		$edit->itmonto->css_class ='inputnum';
     $edit->itmonto->onchange = "cal_totm();";
     $edit->itmonto->value = 0;
     /**************** POR COBRAR ******************************************/
     $porcobrar = $this->db->query("SELECT a.id,a.numero,a.fecha,a.monto,a.nombre,a.observa FROM recibo a WHERE status='P' ORDER BY estampa");
     $porcobrar = $porcobrar->result_array();
     $edit->button_status("btn_add_sfpa", 'Agregar Pago', "javascript:add_sfpa()", "MB", 'modify', "button_add_rel");
     $edit->button_status("btn_add_sfpa2", 'Agregar Pago', "javascript:add_sfpa()", "MB", 'create', "button_add_rel");
     $edit->button_status("btn_add_itabonos", 'Agregar Recibo', "javascript:add_itabonos()", "PA", 'modify', "button_add_rel");
     $edit->button_status("btn_add_itabonos2", 'Agregar Recibo', "javascript:add_itabonos()", "PA", 'create', "button_add_rel");
     if ($this->datasis->puede(388)) {
         $edit->buttons('modify');
     }
     $edit->buttons('add', 'save', 'undo', 'delete', 'back');
     $edit->build();
     $conten["form"] =& $edit;
     //$smenu['link']   =barra_menu('80B');
     //$data['smenu']   = $this->load->view('view_sub_menu', $smenu,true);
     $conten['porcobrar'] = $porcobrar;
     foreach ($porcobrar as $key => $value) {
         $porcobrar[$key]['fecha'] = dbdate_to_human($value['fecha']);
     }
     $conten['porcobrarj'] = json_encode($porcobrar);
     $data['content'] = $this->load->view('view_abonos', $conten, true);
     $data['title'] = $this->t**s;
     $data["head"] = script('jquery.js') . script('jquery-ui.js') . script('plugins/jquery.numeric.pack.js') . script('plugins/jquery.floatnumber.js') . script('plugins/jquery.meiomask.js') . style('vino/jquery-ui.css') . $this->rapyd->get_head();
     $this->load->view('view_ventanas', $data);
 }
Example #25
0
 function doccierre()
 {
     $numero = $this->uri->segment(4);
     $titulo = $this->datasis->traevalor('TITULO1');
     $rif = $this->datasis->traevalor('RIF');
     $mSQL = "SELECT * FROM dine WHERE numero={$numero} ";
     $query = $this->db->query($mSQL);
     $row = $query->row();
     $observa = $row->observa;
     $this->load->library('fpdf');
     $esta =& $this->fpdf;
     $esta->AddPage();
     $esta->image($_SERVER['DOCUMENT_ROOT'] . base_url() . 'images/logotipo.jpg', 10, 8, 40);
     $esta->ln(5);
     $esta->SetFont('Arial', 'B', 16);
     $esta->cell(0, 10, "ARQUEO  DE  CAJA  Nro. {$numero}", 0, 2, 'C');
     $esta->ln(1);
     $esta->SetFont('Arial', 'B', 10);
     $esta->cell(0, 5, "  RIF: " . $rif, 0, 2, 'L');
     $esta->ln(11);
     $esta->SetFont('Arial', '', 10);
     $esta->cell(13, 5, "Caja", 1, 0, 'C');
     $esta->cell(58, 5, "Cajero Entrega(" . $row->cajero . ")", 1, 0, 'C');
     $esta->cell(58, 5, "C.Principal", 1, 0, 'C');
     $esta->cell(20, 5, "Fecha", 1, 0, 'C');
     $esta->cell(20, 5, "Realizado", 1, 0, 'C');
     $esta->cell(21, 5, "N. Fiscal", 1, 2, 'C');
     $nomcaja = $this->datasis->dameval("SELECT nombre FROM scaj WHERE cajero='" . $row->cajero . "'");
     $usuario = $this->datasis->dameval("SELECT us_nombre FROM usuario WHERE us_codigo='" . $row->usuario . "'");
     $esta->ln(0);
     $esta->SetFont('Arial', 'B', 10);
     $esta->cell(13, 7, $row->caja, 1, 0, 'C');
     $esta->cell(58, 7, substr($nomcaja, 0, 22), 1, 0, 'C');
     $esta->cell(58, 7, substr($usuario, 0, 22), 1, 0, 'C');
     $esta->cell(20, 7, dbdate_to_human($row->fecha), 1, 0, 'C');
     $esta->cell(20, 7, dbdate_to_human($row->estampa), 1, 0, 'C');
     $esta->cell(21, 7, $row->nfiscal, 1, 2, 'C');
     $esta->ln(3);
     // NC y Anulaciones
     $devol = $this->datasis->dameval("SELECT sum(gtotal) FROM viefac WHERE caja='" . $row->caja . "' AND fecha='" . $row->fecha . "' AND MID(numero,1,2)='NC' AND cajero='" . $row->cajero . "' ");
     $devolc = $this->datasis->dameval("SELECT COUNT(*) FROM viefac WHERE caja='" . $row->caja . "' AND fecha='" . $row->fecha . "' AND MID(numero,1,2)='NC' AND cajero='" . $row->cajero . "' ");
     $anul = $this->datasis->dameval("SELECT sum(gtotal) FROM viefac WHERE caja='" . $row->caja . "' AND fecha='" . $row->fecha . "' AND MID(numero,1,1)='X' AND cajero='" . $row->cajero . "' ");
     $anulc = $this->datasis->dameval("SELECT COUNT(*) FROM viefac WHERE caja='" . $row->caja . "' AND fecha='" . $row->fecha . "' AND MID(numero,1,1)='X' AND cajero='" . $row->cajero . "' ");
     $esta->cell(30, 7, "Devoluciones", "TBL", 0, 'C');
     $esta->cell(12, 7, number_format($devolc, 0), "TB", 0, 'R');
     $esta->cell(10, 7, "Bs.:", "TB", 0, 'C');
     $esta->cell(25, 7, number_format($devol, 2), "TBR", 0, 'R');
     $esta->cell(36, 7, "", 0, 0, 'C');
     $esta->cell(30, 7, "Anulaciones", "TBL", 0, 'C');
     $esta->cell(12, 7, number_format($anulc, 0), "TB", 0, 'R');
     $esta->cell(10, 7, "Bs.:", "TB", 0, 'C');
     $esta->cell(25, 7, number_format($anul, 2), "TBR", 2, 'R');
     $esta->ln(5);
     $esta->SetFont('Arial', 'B', 12);
     $esta->cell(0, 10, "RESULTADO:", "T", 0, 'L');
     $esta->ln(6);
     $esta->cell(30, 10, '  ', 0, 0);
     $esta->SetFont('Arial', '', 12);
     $esta->cell(60, 10, "Recaudado segun Sistema (a): ", 0, 0, 'R');
     $esta->SetFont('Arial', 'B', 14);
     $esta->cell(40, 10, number_format($row->computa, 2), 0, 0, 'R');
     $esta->ln(6);
     $esta->cell(30, 10, '  ', 0, 0);
     $esta->SetFont('Arial', '', 12);
     $esta->cell(60, 10, "Entregado por el Cajero (b): ", 0, 0, 'R');
     $esta->SetFont('Arial', 'B', 14);
     $esta->cell(40, 10, number_format($row->recibido, 2), 0, 0, 'R');
     $esta->ln(8);
     $esta->cell(90, 1, '', 0, 0);
     $esta->cell(40, 1, '', 'B', 0);
     $esta->ln(0);
     $esta->cell(30, 10, '  ', 0, 0);
     $esta->SetFont('Arial', '', 12);
     $esta->cell(60, 10, "Diferencia (a-b): ", 0, 0, 'R');
     $esta->SetFont('Arial', 'B', 14);
     $esta->cell(40, 10, number_format($row->computa - $row->recibido, 2), 0, 0, 'R');
     $esta->ln(15);
     $esta->SetFont('Arial', 'B', 12);
     $esta->cell(0, 10, "DETALLE DE LO RECAUDADO:", "T", 0, 'L');
     $esta->ln(10);
     $esta->cell(20, 5, '  ', 0, 0);
     $esta->SetFont('Arial', 'BI', 10);
     $esta->cell(50, 5, "FORMAS DE PAGO", "B", 0, 'R');
     $esta->cell(30, 5, "Sistema", "B", 0, 'R');
     $esta->cell(30, 5, "Recibido", "B", 0, 'R');
     $esta->cell(30, 5, "Diferencia", "B", 0, 'R');
     $esta->ln(5);
     $mSQL = "SELECT referen,sum(compumo) compumo, sum(total) total FROM itdine WHERE numero={$numero} AND tipo<>'CT' GROUP BY tipo  ORDER BY referen";
     $query->free_result();
     $query = $this->db->query($mSQL);
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $esta->cell(20, 5, '  ', 0, 0);
             $esta->SetFont('Arial', '', 10);
             $esta->cell(50, 5, $row->referen, 0, 0, 'R');
             $esta->SetFont('Arial', 'B', 10);
             $esta->cell(30, 5, number_format($row->compumo, 2), 0, 0, 'R');
             $esta->cell(30, 5, number_format($row->total, 2), 0, 0, 'R');
             $esta->cell(30, 5, number_format($row->compumo - $row->total, 2), 0, 0, 'R');
             $esta->ln(5);
         }
     }
     $esta->ln(3);
     $esta->cell(20, 5, '  ', 0, 0);
     $esta->SetFont('Arial', 'BI', 10);
     $esta->cell(50, 5, "CESTA TICKETS", "B", 0, 'R');
     $esta->cell(30, 5, "Sistema", "B", 0, 'R');
     $esta->cell(30, 5, "Recibido", "B", 0, 'R');
     $esta->cell(30, 5, "Diferencia", "B", 0, 'R');
     $esta->ln(5);
     $mSQL = "SELECT referen,sum(compumo) compumo, sum(total) total FROM itdine WHERE numero={$numero} AND tipo='CT' GROUP BY referen ";
     $query->free_result();
     $query = $this->db->query($mSQL);
     if ($query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $esta->cell(20, 5, '', 0, 0, 'R');
             $esta->SetFont('Arial', '', 10);
             $esta->cell(50, 5, $row->referen, 0, 0, 'R');
             $esta->SetFont('Arial', 'B', 10);
             $esta->cell(30, 5, number_format($row->compumo, 2), 0, 0, 'R');
             $esta->cell(30, 5, number_format($row->total, 2), 0, 0, 'R');
             $esta->cell(30, 5, number_format($row->compumo - $row->total, 2), 0, 0, 'R');
             $esta->ln(5);
         }
     }
     $esta->ln(15);
     $esta->SetFont('Arial', 'B', 12);
     $esta->cell(0, 10, "OBSERVACIONES:", "T", 0, 'L');
     $esta->ln(10);
     $esta->SetFont('Arial', '', 10);
     $esta->cell(20, 5, '', 0, 0, 'R');
     $esta->multicell(130, 5, $observa, 0);
     $esta->ln(5);
     $esta->SetFont('Arial', 'B', 12);
     $esta->cell(0, 10, "FIRMAS:", 0, 0, 'L');
     $esta->ln(30);
     $esta->SetFont('Arial', '', 8);
     $esta->cell(15, 5, '', 0, 0, 'R');
     $esta->cell(60, 5, $nomcaja, "T", 0, 'C');
     $esta->cell(10, 5, '', 0, 0, 'R');
     $esta->cell(60, 5, $usuario, "T", 0, 'C');
     $esta->Output();
 }
Example #26
0
		<td class="littletablerowth"><?php 
echo $form->codigo->label;
?>
</td>
		<td class="littletablerow"  ><?php 
echo $form->codigo->value;
?>
</td>
	</tr>
	<tr>
		<td class="littletablerowth"><?php 
echo $form->fecha->label;
?>
</td>
		<td class="littletablerow"  ><?php 
echo dbdate_to_human($form->fecha->value);
?>
</td>
		<td class="littletablerowth" align='center'><?php 
echo $form->frec->label . " " . $frec;
?>
</td>
		<td class="littletablerowth"><?php 
echo $form->total->label;
?>
</td>
		<td class="littletablerow"  ><?php 
echo nformat($form->total->value);
?>
</td>
	</tr>
Example #27
0
					<td align='center'>Emisi&oacute;n &nbsp;</td>
					<td align='center'>Impuesto &nbsp;</td>
					<td align='center'>Monto &nbsp;</td>
					<td align='center'>% &nbsp;</td>
				</tr>
				<tr>
					<td class="littletablerow" align='center'><?php 
            echo $row->periodo;
            ?>
&nbsp;</td>
					<td class="littletablerow" align='center'><?php 
            echo $row->nrocomp;
            ?>
&nbsp;</td>
					<td class="littletablerow" align='center'><?php 
            echo dbdate_to_human($row->emision);
            ?>
&nbsp;</td>
					<td class="littletablerow" align='center'><?php 
            echo nformat($row->impuesto);
            ?>
&nbsp;</td>
					<td class="littletablerow" align='center'><?php 
            echo nformat($row->reiva);
            ?>
&nbsp;</td>
					<td class="littletablerow" align='center'><?php 
            echo nformat($row->porcent);
            ?>
&nbsp;</td>
				</tr>
Example #28
0
 function traereferen()
 {
     $numero = $this->db->escape($this->input->post('referen'));
     $query = $this->db->query("SELECT fecha,cajero FROM sfac WHERE numero={$numero} AND tipo_doc='F'");
     if ($query->num_rows() > 0) {
         $row = $query->row();
         echo 'Fecha: ' . dbdate_to_human($row->fecha) . ' Cajero: "' . $row->cajero . '"';
         //echo json_encode($row);
     } else {
         echo 'Referencia no encontrada';
     }
 }
Example #29
0
 function GroupTableHeader($row, $n = 0)
 {
     for ($i = $n - 1; $i < count($this->grupo); $i++) {
         if (!empty($this->grupoLabel[$i])) {
             $sal = $this->_parsePattern($this->grupoLabel[$i]);
             if (count($sal) > 0) {
                 $label = $this->grupoLabel[$i];
                 foreach ($sal as $pasa) {
                     if ($this->DBfieldsType[$pasa] == 'date') {
                         $row[$pasa] = dbdate_to_human($row[$pasa]);
                     }
                     $label = str_replace('<#' . $pasa . '#>', $row[$pasa], $label);
                 }
             } else {
                 $label = $this->grupoLabel[$i];
             }
         } else {
             $label = $this->grupo[$i] . ' ' . $row[$this->grupo[$i]];
         }
         $linea = 'A' . $this->ii;
         $arreglo[0] = $label;
         $this->worksheet->write_row($linea, $arreglo, $this->h4);
         $this->ii++;
     }
 }
Example #30
0
        for ($i = 0; $i < count($porcobrar); $i++) {
            ?>
					<tr id='tr_porcobrar_<?php 
            echo $i;
            ?>
'>
					<td class="littletablerow">              <?php 
            echo form_checkbox('chrecibo_' . $i, '', FALSE);
            ?>
&nbsp;</td>
					<td class="littletablerow">              <?php 
            echo $porcobrar[$i]['numero'];
            ?>
&nbsp;</td>
					<td class="littletablerow">              <?php 
            echo dbdate_to_human($porcobrar[$i]['fecha']);
            ?>
&nbsp;</td>
					<td class="littletablerow" align="right"><?php 
            echo nformat($porcobrar[$i]['monto']);
            ?>
&nbsp;</td>
					<td class="littletablerow"              ><?php 
            echo $porcobrar[$i]['nombre'];
            ?>
&nbsp;</td>
					<td class="littletablerow"              ><?php 
            echo $porcobrar[$i]['observa'];
            ?>
&nbsp;</td>
					</tr>