public function excelContent(&$worksheet, &$row, &$data, $campos)
 {
     //cabecera
     foreach ($campos['head'] as $kcamp => $camp) {
         $worksheet->write($row, $kcamp, $camp, $this->formatsEx['format3']);
     }
     //Contenidos
     $row++;
     foreach ($data as $key => $item) {
         foreach ($campos['conte'] as $kcamp => $camp) {
             if ($camp['sum'] != -1) {
                 $item->{$camp['name']} = String::float($item->{$camp['name']});
                 $campos['conte'][$kcamp]['sum'] += $item->{$camp['name']};
             } else {
                 $item->{$camp['name']} = utf8_decode($item->{$camp['name']});
             }
             if (isset($item->is_total_final)) {
                 if (!empty($item->{$camp['name']})) {
                     $worksheet->write($row, $kcamp, strip_tags($item->{$camp['name']}), $this->formatsEx['format5']);
                 }
             } else {
                 $worksheet->write($row, $kcamp, strip_tags($item->{$camp['name']}), $this->formatsEx[$camp['format']]);
             }
         }
         $row++;
     }
     //Totales
     foreach ($campos['conte'] as $kcamp => $camp) {
         if ($camp['sum'] != -1) {
             $worksheet->write($row, $kcamp, $campos['conte'][$kcamp]['sum'], $this->formatsEx['format5']);
         }
     }
 }
 public function addNotaVenta()
 {
     $id_nota_venta = BDUtil::getId();
     $data = array('id_nota_venta' => $id_nota_venta, 'id_cliente' => $this->input->post('tcliente'), 'folio' => $this->input->post('tfolio'), 'fecha' => $this->input->post('tfecha'), 'tipo_pago' => $this->input->post('tipo_pago'), 'dias_credito' => $this->input->post('tdias_credito'), 'subtotal' => $this->input->post('subtotal'), 'iva' => $this->input->post('iva'), 'total' => $this->input->post('total'));
     $this->db->insert('tickets_notas_venta', $data);
     foreach ($_POST as $ticket) {
         if (is_array($ticket)) {
             $data_t = array('id_nota_venta' => $id_nota_venta, 'id_ticket' => $ticket['id_ticket'], 'cantidad' => String::float($ticket['cantidad']), 'taza_iva' => String::float($ticket['taza_iva']), 'precio_unitario' => String::float($ticket['precio_unitario']), 'importe' => String::float($ticket['importe']), 'importe_iva' => String::float($ticket['importe_iva']), 'total' => String::float($ticket['total']));
             $this->db->insert('tickets_notas_venta_tickets', $data_t);
         }
     }
     if ($_POST['tipo_pago'] == 'contado') {
         $concepto = "Pago total de la venta ({$_POST['tfolio']})";
         $res = $this->abonar_nota_venta(true, $id_nota_venta, null, $concepto);
     } elseif ($_POST['tipo_pago'] == 'credito') {
         $res = $this->abonar_nota_venta(false, $id_nota_venta, null, "");
     }
     $folio = $this->getNxtFolio();
     return array(true, 'id_nota_venta' => $id_nota_venta, 'folio' => $folio[0][0]->folio);
 }
Exemple #3
0
 public function addTicket()
 {
     $id_ticket = BDUtil::getId();
     $data = array('id_ticket' => $id_ticket, 'id_cliente' => $this->input->post('tcliente'), 'folio' => $this->input->post('tfolio'), 'fecha' => $this->input->post('tfecha'), 'tipo_pago' => $this->input->post('tipo_pago'), 'dias_credito' => $this->input->post('tdias_credito'), 'subtotal' => $this->input->post('subtotal'), 'iva' => $this->input->post('iva'), 'total' => $this->input->post('total'));
     $this->db->insert('tickets', $data);
     foreach ($_POST as $vuelo) {
         if (is_array($vuelo)) {
             if ($vuelo['tipo'] == 'vu') {
                 $data_v = array('id_ticket' => $id_ticket, 'id_vuelo' => $vuelo['id_vuelo'], 'cantidad' => String::float($vuelo['cantidad']), 'taza_iva' => String::float($vuelo['taza_iva']), 'precio_unitario' => String::float($vuelo['precio_unitario']), 'importe' => String::float($vuelo['importe']), 'importe_iva' => String::float($vuelo['importe_iva']), 'total' => String::float($vuelo['total']));
                 $this->db->insert('tickets_vuelos', $data_v);
             } elseif ($vuelo['tipo'] == 'pr') {
                 $id_producto = BDUtil::getId();
                 $data_p = array('id_ticket' => $id_ticket, 'id_ticket_producto' => $id_producto, 'cantidad' => String::float($vuelo['cantidad']), 'descripcion' => $vuelo['descripcion'], 'id_unidad' => $vuelo['unidad'], 'taza_iva' => String::float($vuelo['taza_iva']), 'precio_unitario' => String::float($vuelo['precio_unitario']), 'importe' => String::float($vuelo['importe']), 'importe_iva' => String::float($vuelo['importe_iva']), 'total' => String::float($vuelo['total']));
                 $this->db->insert('tickets_productos', $data_p);
             }
         }
     }
     if ($_POST['tipo_pago'] == 'contado') {
         $concepto = "Pago total del ticket ({$_POST['tfolio']})";
         $res = $this->abonar_ticket(true, $id_ticket, null, $concepto);
     }
     $folio = $this->getNxtFolio();
     return array(true, 'id_ticket' => $id_ticket, 'folio' => $folio[0][0]->folio);
 }
 public function productosTicket($data, $data_info)
 {
     //$this->SetY($this->GetY()+3);
     $this->SetFont('Arial', '', 8);
     $this->SetWidths(array(62));
     $this->SetAligns(array('L'));
     //$this->Row(array('ARTICULO'), false, false);
     $this->SetWidths(array(12, 19, 15, 15));
     $this->SetAligns(array('L'));
     $this->Row(array('CANT.', 'PRECIO/UN.', 'IMPORTE', '% DESC'), false, false);
     $this->SetFont('Arial', '', 8);
     $this->CheckPageBreak(4);
     $this->MultiCell($this->pag_size[0], 3, '--------------------------------------------------------------', 0, 'L');
     if (is_array($data_info)) {
         foreach ($data_info as $prod) {
             $this->SetFont('Arial', '', 12);
             $this->SetWidths(array(62));
             $this->SetAligns(array('L'));
             $this->Row(array($prod->nombre), false, false);
             $this->SetFont('Arial', '', 8);
             $this->CheckPageBreak(4);
             $this->SetWidths(array(12, 19, 15, 15));
             $this->SetAligns(array('L'));
             $this->Row(array($prod->cantidad, String::formatoNumero($prod->precio_venta, 2), String::formatoNumero($prod->importe, 2), $prod->descuento . '%'), false, false);
             $this->SetY($this->GetY());
         }
     }
     $this->CheckPageBreak(4);
     $this->MultiCell($this->pag_size[0], 3, '---------------------------------------------------------------', 0, 'L');
     $this->SetWidths(array(31, 30));
     $this->SetAligns(array('L'));
     //$this->Row(array( 'SUB-TOTAL SIN IVA', String::formatoNumero($data[0]->subtotal_no_iva)), false, false, 3);
     $descuento_dinero = String::float($data[0]->subtotal_no_iva * ($data[0]->descuento / 100), false, 2);
     //$this->Row(array( "DESCUENTO ({$data[0]->descuento}%)" , String::formatoNumero($descuento_dinero)), false, false, 3);
     $this->Row(array('SUB-TOTAL', String::formatoNumero($data[0]->subtotal_no_iva - $descuento_dinero)), false, false, 3);
     $this->Row(array('IVA', String::formatoNumero($data[0]->iva)), false, false, 3);
     $this->SetFont('Arial', '', 10);
     $this->CheckPageBreak(4);
     $this->Row(array('TOTAL', String::formatoNumero($data[0]->total)), false, false, 3);
     $this->SetFont('Arial', '', 6);
     $this->CheckPageBreak(4);
     $this->SetY($this->GetY() + 5);
     $this->Row(array('PAGO CON', String::formatoNumero($data[0]->recibido)), false, false, 3);
     $this->SetFont('Arial', '', 10);
     $this->CheckPageBreak(4);
     $this->Row(array('CAMBIO', String::formatoNumero($data[0]->cambio)), false, false, 3);
     //$this->SetY($this->GetY() + 3);
     //$this->Row(array( 'TIPO DE PAGO', strtoupper($data[0]->tipo_pago)), false, false, 3);
 }
			<td></td>
		</tr>
<?php 
$total_cargo = 0;
$total_abono = 0;
$total_saldo = 0;
if (isset($cuentasp['anterior'][0]->saldo)) {
    //se suma a los totales saldo anterior
    $total_cargo += $cuentasp['anterior'][0]->total;
    $total_abono += $cuentasp['anterior'][0]->abonos;
    $total_saldo += $cuentasp['anterior'][0]->saldo;
}
foreach ($cuentasp['cuentas'] as $cuenta) {
    $ver = true;
    //verifica q no sea negativo o exponencial el saldo
    $cuenta->saldo = floatval(String::float($cuenta->saldo));
    if ($cuenta->saldo == 0) {
        $cuenta->estado = 'Pagada';
        $cuenta->fecha_vencimiento = $cuenta->dias_transc = '';
        if ($this->input->get('ftipo') == 'pv') {
            $ver = false;
        }
    }
    if ($ver) {
        $total_cargo += $cuenta->cargo;
        $total_abono += $cuenta->abono;
        $total_saldo += $cuenta->saldo;
        ?>
		<tr>
			<td><?php 
        echo $cuenta->fecha;
 public function addInventario($id, $data = null)
 {
     if ($data == null) {
         $data = array('base_id' => $id, 'cantidad' => $this->input->post('dcantidad'), 'precio_compra' => $this->input->post('dprecio_compra'), 'importe' => String::float($this->input->post('dcantidad') * $this->input->post('dprecio_compra')));
     }
     $this->db->insert('productos_base_entradas', $data);
     return array(true, '');
 }
 public function addGastoPiloto()
 {
     $id_gasto = BDUtil::getId();
     $data = array('id_compra' => $id_gasto, 'id_proveedor' => $this->input->post('tpiloto'), 'id_empleado' => $_SESSION['id_empleado'], 'serie' => mb_strtoupper($this->input->post('tserie'), 'utf-8'), 'folio' => $this->input->post('tfolio'), 'fecha' => $this->input->post('tfecha'), 'subtotal' => $this->input->post('subtotal'), 'importe_iva' => $this->input->post('iva'), 'total' => $this->input->post('total'), 'concepto' => $this->input->post('tconcepto'), 'is_gasto' => 't', 'status' => 'pa');
     $this->db->insert('compras', $data);
     foreach ($_POST as $vuelo) {
         if (is_array($vuelo)) {
             $data_v = array('id_compra' => $id_gasto, 'id_vuelo' => $vuelo['id_vuelo'], 'cantidad' => String::float($vuelo['cantidad']), 'taza_iva' => String::float($vuelo['taza_iva']), 'precio_unitario' => String::float($vuelo['precio_unitario']), 'importe' => String::float($vuelo['importe']), 'importe_iva' => String::float($vuelo['importe_iva']), 'total' => String::float($vuelo['total']));
             $this->db->insert('compras_gastos_vuelos', $data_v);
         }
     }
     return array(true);
 }
 /**
  * Genera el reporte en pdf reporte bajos de inventario
  */
 public function RBajoInventario($fecha1 = null, $fecha2 = null)
 {
     $this->load->library('mypdf');
     // Creación del objeto de la clase heredada
     $pdf = new MYpdf('L', 'mm', 'Letter');
     $pdf->show_head = true;
     $pdf->titulo2 = 'Reporte bajos de inventario';
     $data = $this->getDataRBajoInventario($fecha1, $fecha2);
     $pdf->titulo1 = $data['titulo1'];
     $pdf->titulo3 = $data['titulo3'];
     $pdf->logo = $data['logo'];
     $pdf->AliasNbPages();
     // $links = array('', '', '', '');
     $pdf->SetY(30);
     $aligns = array('L', 'C', 'C', 'C', 'C', 'C', 'L', 'L');
     $widths = array(65, 25, 15, 25, 20, 30, 40, 50);
     $header = array('Nombre', 'Existencia', 'Stock min', 'Faltante min', 'Precio compra', 'Gasto', 'Proveedor', 'Direccion');
     $total = 0;
     foreach ($data['info'] as $key => $item) {
         $band_head = false;
         if ($pdf->GetY() >= $pdf->limiteY || $key == 0) {
             $pdf->AddPage();
             $pdf->SetFont('Arial', 'B', 8);
             $pdf->SetTextColor(255, 255, 255);
             $pdf->SetFillColor(160, 160, 160);
             $pdf->SetX(6);
             $pdf->SetAligns($aligns);
             $pdf->SetWidths($widths);
             $pdf->Row($header, true);
         }
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetTextColor(0, 0, 0);
         $faltante = String::float($item->stock_min - $item->existencia);
         $importe = String::float($faltante * $item->precio_compra);
         $datos = array($item->nombre, String::formatoNumero($item->existencia, 0, ''), String::formatoNumero($item->stock_min, 0, ''), String::formatoNumero($faltante, 0, ''), String::formatoNumero($item->precio_compra, 2, ''), String::formatoNumero($importe, 2, ''), $item->proveedor, $item->direccion);
         $total += $importe;
         $pdf->SetX(6);
         $pdf->SetAligns($aligns);
         $pdf->SetWidths($widths);
         $pdf->Row($datos, false, true);
     }
     $pdf->SetX(6);
     $pdf->SetFont('Arial', 'B', 8);
     $pdf->SetTextColor(255, 255, 255);
     $pdf->Row(array('', '', '', '', 'Gasto min:', String::formatoNumero($total)), true);
     $pdf->Output('reporte_bajos_inventario.pdf', 'I');
 }