<?php
//include "clase.conexion.php";
class clsLiquidacionDia extends clsConexion{
	public $varTitulo 	= "LIQUIDACION DIARIA";
	function FormuBusqueda() {
		$sqanio = "select distinct id_anio, id_anio from _sv_metas order by id_anio desc;";
		$varTabla=array("id"=>"tabla", "name"=>"table", "tamano"=>"400", "clase"=>"Formtitulo", "titulo"=>$this->varTitulo,
						"formu"=>array("id"=>"form", "name"=>"form", "metodo"=>"POST", "onsubmit"=>"return false;"),						
						"ocult"=>array(array("tipo"=>"oculto", "id"=>"titu", "name"=>"titu", "valor"=>$this->varTitulo)
									  ),
						"conte"=>array(array("titulo"=>"Fecha Venta :", "clase1"=>"FormCampo1", "clase2"=>"interior", "tamano"=>100,
											 "campo"=>array("tipo"=>"fecha", "id"=>"femi", "name"=>"femi", "alinear"=>"center",
											 				"valor"=>$varFINI) 
											 ),
									   ),
						"boton"=>array(array("tipo"=>"submit", "id"=>"bcon", "name"=>"bcon", "ancho"=>"100", "texto"=>"Buscar",
					  					   "clase"=>"boton_buscar", "click"=>"javascript:xBuscarJS()"),
									 array("tipo"=>"button", "id"=>"bexp", "name"=>"bexp", "ancho"=>"100", "texto"=>"Exportar",
									 	   "clase"=>"boton_exportar", "click"=>"javascript:xExportarJS()"),								
									 array("tipo"=>"button", "id"=>"bimp", "name"=>"bimp", "ancho"=>"100", "texto"=>"Imprimir", 
										   "clase"=>"boton_imprimir", "click"=>"javascript:xImprimirJS('', 'NEW')"),
									 )
						);
		return $this->setTablaForm($varTabla);
		}
 	function GridDatos($varForm = NULL)  
		{
		$varDia = FechaMySql($varForm["femi"]);			  
		$sql = "call spQuery_Packing_Liquidacion_Dia('$varDia');";
		$varCab = array(array("cab"=>"DATOS", "det"=>array("PDV","FACTURADO","CONTADO","CREDITO","PARCIAL","RECHAZO","EFECTIVO","%PARC.","%RECH.","%EFEC."))
						);
		$varNiv = array(0 =>array("COD"=>"CRUT","DES"=>"RUTA"),
						1 =>array("COD"=>"CVEN","DES"=>"VENDEDOR"),
						2 =>array("COD"=>"CTIP","DES"=>"TIPO"));
		$varFor = array(13=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>10, "funcion"=>"porc")),
						14=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>11, "funcion"=>"porc")),
						15=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>12, "funcion"=>"porc"))
						);
		$varReturn =  $this->setGridCombina($varCab, $sql, $varNiv, NULL, $varFor);
		return $varReturn;
		}
	function Imprimir ($varDia = NULL)  
		{
		$varDia1 = FechaMySql($varDia);			  
		$sql = "call spQuery_Packing_Liquidacion_Dia('$varDia1');";
		$varCab = array(array("cab"=>"DATOS", "det"=>array("PDV","FACTURADO","CONTADO","CREDITO","PARCIAL","RECHAZO","EFECTIVO","%PARC.","%RECH.","%EFEC."))
						);
		$varNiv = array(0 =>array("COD"=>"CRUT","DES"=>"RUTA"),
						1 =>array("COD"=>"CVEN","DES"=>"VENDEDOR"),
						2 =>array("COD"=>"CTIP","DES"=>"TIPO"));
					
		$varFor = array(13=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>10, "funcion"=>"porc")),
						14=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>11, "funcion"=>"porc")),
						15=>array("tipodat"=>"porc", "formula"=>array("valor1"=>7, "valor2"=>12, "funcion"=>"porc"))
						);
		$html='<table style="width: 98%; padding: 0; margin-top:10px; margin-bottom:10px; border-collapse:collapse;" align="center">';
		$html.='<thead>';
		$html.='<tr>';
		$html.='<td>';
		$html.='<table style="width: 100%;">';
		$html.='<tr>';
		$html.='<td style="width: 15%; vertical-align: middle; text-align:left;"><b>Dia Liquidado</b></td>';
		$html.='<td style="width: 1%; vertical-align: middle; text-align:center;"><b></b></td>';
		$html.='<td style="width: 34%; vertical-align: middle; text-align:left;"><b></b></td>';
		$html.='<td style="width: 50%; vertical-align: middle; text-align:right;"><b>'.Config("SYSEMP").'</b></td>';
		$html.='</tr>';
		$html.='<tr>';
		$html.='<td style="vertical-align: middle; text-align:left;"><b>'.$varDia.'</b></td>';
		$html.='<td style="vertical-align: middle; text-align:center;"><b></b></td>';
		$html.='<td style="vertical-align: middle; text-align:left;"><b></b></td>';
		$html.='<td style="vertical-align: middle; text-align:right;"><b>'.$this->varTitulo.'</b></td>';
		$html.='</tr>';
		$html.='<tr>';
		$html.='<td style="vertical-align: middle; text-align:left;"><b></b></td>';
		$html.='<td style="vertical-align: middle; text-align:center;"><b></b></td>';
		$html.='<td style="width: 50%; vertical-align: middle; text-align:left;"><b>';

		$html.='</b></td>';
		$html.='<td style="width: 50%; vertical-align: middle; text-align:right;">'.MostrarFechaActual().'</td>';
		$html.='</tr>';
		$html.='</table>';
		$html.='</td>';
		$html.='</tr>';
		$html.='</thead>';	
		$html.='<tr>';
		$html.='<td>';				
		$html.= $this->setGridCombinaPrint($varCab, $sql, $varNiv, NULL, $varFor);
		$html.='</td>';
		$html.='</tr>';			
		$html.='</table>';
		return $html;
		}
	}
?>