<?php

ini_set("display_errors", "On");

require_once $_SERVER["DOCUMENT_ROOT"] . "/shine/datos/clsQuery.php";

class estadoCuenta extends Query
{
    var $global_compra_inicial = 0;

    var $global_inversion_inicial = 0;
    var $global_status_inicial = "";
    var $global_almacen_inicial = "";
	var $global_fecha_inversion_inicial = "";

    var $filas = null;

    function __construct()
    {
        parent::__construct();

        parent::MET_Conectar();
    }

    function MET_consulta($identificacion, $docentry, $opcion, $filtrar)
    {
        if ($opcion == 1) {
            if ($docentry == 0) {
                $sql = "						 SELECT							DICOSE,							TIPOCONTRATO,							LOCATION,							DOCNUM,							ALMACEN,							NOMBALMACEN,							NOMBRESOCIO,							U_SEI_CONCEPTOS,							NROCABEZAS,							CATEGORIA,							DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') AS FECHAMOVIMIENTO,							WEIGHT1,							U_SEI_FACTURAS,							TOTALUSD,							COSTOFLETE,							COSTOSANIDAD,							PORC_SMGZ,							PORC_ZAMBRANO,							INVERSIONTOTAL AS TOTALINVERSIONSEGUI, 							COBRA_DC,							PORC_MUNICIPAL,							COBRAINVERSOR,							DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS FECHADECOBRO,							NROGUIA						  FROM							sei_rpt_seguimientos2						WHERE ALMACEN =  \'$identificacion\' 												AND UPPER(TRIM(U_SEI_CONCEPTOS)) IN (							\'COMPRAINICIAL\',							\'VENTA\',							\'MUERTE\',							\'NACIMIENTO\')						ORDER BY DOCNUM, FECHAMOVIMIENTO 					";
            } else {
                $sql = "							 SELECT								DICOSE,								TIPOCONTRATO,								LOCATION,								DOCNUM,								ALMACEN,								NOMBALMACEN,								NOMBRESOCIO,								U_SEI_CONCEPTOS,								NROCABEZAS,								CATEGORIA,								DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') AS FECHAMOVIMIENTO,								WEIGHT1,								U_SEI_FACTURAS,								TOTALUSD,								COSTOFLETE,								COSTOSANIDAD,								PORC_SMGZ,								PORC_ZAMBRANO,								INVERSIONTOTAL AS TOTALINVERSIONSEGUI, 								COBRA_DC,								PORC_MUNICIPAL,								COBRAINVERSOR,								DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS FECHADECOBRO,								NROGUIA							  FROM								sei_rpt_seguimientos2							WHERE ALMACEN =  \'$identificacion\' 														AND CODIGOSOCIO = \'$docentry\'							AND UPPER(TRIM(U_SEI_CONCEPTOS)) IN (								\'COMPRAINICIAL\',								\'VENTA\',								\'MUERTE\',								\'NACIMIENTO\')							ORDER BY DOCNUM, FECHAMOVIMIENTO 						";
            }
        } else {
            if ($docentry == 0) {
                $sql = "						 SELECT							DICOSE,							TIPOCONTRATO,							LOCATION,							DOCNUM,							ALMACEN,							NOMBALMACEN,							NOMBRESOCIO,							U_SEI_CONCEPTOS,							NROCABEZAS,							CATEGORIA,							DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') AS FECHAMOVIMIENTO,							WEIGHT1,							U_SEI_FACTURAS,							TOTALUSD,							COSTOFLETE,							COSTOSANIDAD,							PORC_SMGZ,							PORC_ZAMBRANO,							INVERSIONTOTAL AS TOTALINVERSIONSEGUI, 							COBRA_DC,							PORC_MUNICIPAL,							COBRAINVERSOR,							DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS FECHADECOBRO,							NROGUIA						  FROM							sei_rpt_seguimientos2						WHERE ALMACEN =  \'$identificacion\' 												AND UPPER(TRIM(U_SEI_CONCEPTOS)) IN (							\'COMPRAINICIAL\',							\'VENTA\',							\'MUERTE\',							\'NACIMIENTO\')						AND (							NOMBRESOCIO LIKE \'%$filtrar%\' OR							U_SEI_CONCEPTOS LIKE \'%$filtrar%\' OR							CATEGORIA LIKE \'%$filtrar%\' OR							CAST(NROCABEZAS AS VARCHAR(100)) LIKE \'%$filtrar%\' OR							CAST(DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') AS VARCHAR(10)) LIKE \'%$filtrar%\' OR							CAST(U_SEI_FACTURAS AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(COSTOFLETE AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(WEIGHT1 AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(INVERSIONTOTAL AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(COBRA_DC AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(COBRAINVERSOR AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS VARCHAR(10)) LIKE \'%$filtrar%\'						)						ORDER BY DOCNUM, FECHAMOVIMIENTO 					";
            } else {
                $sql = "						 SELECT							DICOSE,							TIPOCONTRATO,							LOCATION,							DOCNUM,							ALMACEN,							NOMBALMACEN,							NOMBRESOCIO,							U_SEI_CONCEPTOS,							NROCABEZAS,							CATEGORIA,							DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') AS FECHAMOVIMIENTO,							WEIGHT1,							U_SEI_FACTURAS,							TOTALUSD,							COSTOFLETE,							COSTOSANIDAD,							PORC_SMGZ,							PORC_ZAMBRANO,							INVERSIONTOTAL AS TOTALINVERSIONSEGUI, 							COBRA_DC,							PORC_MUNICIPAL,							COBRAINVERSOR,							DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS FECHADECOBRO,							NROGUIA						  FROM							sei_rpt_seguimientos2						WHERE ALMACEN =  \'$identificacion\' 												AND CODIGOSOCIO = \'$docentry\'						AND UPPER(TRIM(U_SEI_CONCEPTOS)) IN (							\'COMPRAINICIAL\',							\'VENTA\',							\'MUERTE\',							\'NACIMIENTO\')						AND (							NOMBRESOCIO LIKE \'%$filtrar%\' OR							U_SEI_CONCEPTOS LIKE \'%$filtrar%\' OR							CATEGORIA LIKE \'%$filtrar%\' OR							CAST(NROCABEZAS AS VARCHAR(100)) LIKE \'%$filtrar%\' OR							CAST(DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') AS VARCHAR(10)) LIKE \'%$filtrar%\' OR							CAST(U_SEI_FACTURAS AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(COSTOFLETE AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(WEIGHT1 AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(INVERSIONTOTAL AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(COBRA_DC AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(COBRAINVERSOR AS VARCHAR(50)) LIKE \'%$filtrar%\' OR							CAST(DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS VARCHAR(10)) LIKE \'%$filtrar%\'						)						ORDER BY DOCNUM, FECHAMOVIMIENTO 					";
            }
        }

        parent::__set("sql", $sql);

        $registros = parent::MET_Select();

        //print_r($registros);exit;

        return $registros;
    } // end MET_consultaLibro

    function MET_fillTable($identificacion, $docentry, $opcion, $filtrar)
    {
        $registros = $this->MET_consulta(
            $identificacion,
            $docentry,
            $opcion,
            $filtrar
        );
        $cobradc_total = 0;

        $cnt_total = 0;

        $val_costo = 0;

        if (!$registros) {
            $this->filas =
                '<tr> 

       		<td><div align="center" colspan="5"> ' .
                $this->msj_query .
                '</div></td>

       				</tr>';
        } else {
            foreach ($registros as $ind => $reg) {
                if ($ind % 2 == 0) {
                    $etiq_tr = '<tr class="filapar_consulta"';
                } else {
                    $etiq_tr = '<tr class="filaimpar_consulta"';
                }

		if ($ind == 0) {
			$_SESSION['fechainversion'] = substr($reg["FECHAMOVIMIENTO"], 0, 10);
		}

                $this->filas .=
                    '

   				<tr ' .
                    $etiq_tr .
                    '>

   				<td align=center>' .
                    $reg["NOMBRESOCIO"] .
                    '</td>

   				<td align=center>' .
                    $reg["U_SEI_CONCEPTOS"] .
                    '</td>				

   				<td align=center>' .
                    $reg["CATEGORIA"] .
                    '</td>

   				<td align=center>' .
                    $reg["NROCABEZAS"] .
                    '</td>

   				<td align=center>' .
                    substr($reg["FECHAMOVIMIENTO"], 0, 10) .
                    '</td>

   				<td align=center>' .
                    $reg["U_SEI_FACTURAS"] .
                    '</td>

   				<td align=center>' .
                    $reg["COSTOFLETE"] .
                    '</td>

   				<td align=center>' .
                    $reg["WEIGHT1"] .
                    '</td>

   				<td align=center>' .
                    number_format($reg["TOTALINVERSIONSEGUI"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    number_format($reg["COBRA_DC"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    number_format($reg["COBRAINVERSOR"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    substr($reg["FECHADECOBRO"], 0, 10) .
                    '</td>

   				

     				</tr>

   				';

                $cnt_total += $reg["NROCABEZAS"];
                $cobradc_total += $reg["COBRA_DC"];

                //	$val_costo+=$reg['val_costo'];

                $_SESSION["dicose"] = $reg["DICOSE"];

                $_SESSION["nombalmacen"] = $reg["NOMBALMACEN"];
            } //end foreach

            $this->filas .=
                '

   				<tr ' .
                $etiq_tr .
                '>

   				<td colspan = "3">' .
                "<b>SALDO CABEZAS</b>" .
                '</td>

   				<td align=center><b>' .
                $cnt_total .
                '</b></td>

     				</tr>

   				';
            $this->filas .=
                "				<tr " .
                $etiq_tr .
                '>				<td colspan = "9">' .
                "<b>TOTAL A COBRAR DC</b>" .
                "</td>				<td align=center><b>" .
                number_format($cobradc_total, 2, ",", ".") .
                "</b></td>  				</tr>				";
        } //end if

        return $this->filas;
    } // end MET_fillCombo*/

    /***************************************************************************************************/

    /***************************************************************************************************/

    /*									METODOS CONSULTA POR INVERSOR								   */

    /***************************************************************************************************/

    /***************************************************************************************************/

    function MET_consulta2($identificacion, $docentry)
    {
        $sql = "

   				 SELECT

   					DICOSE,

   					TIPOCONTRATO,

   					LOCATION,

   					DOCNUM,

   					ALMACEN,

   					NOMBALMACEN,

   					NOMBRESOCIO,

   					UPPER(U_SEI_CONCEPTOS) AS U_SEI_CONCEPTOS,

   					NROCABEZAS,

   					CATEGORIA,					CASE						UPPER(TRIM(U_SEI_CONCEPTOS))						WHEN \'NACIMIENTO\' 						THEN DATE_FORMAT(FECHANACIMIENTO,\'%d/%m/%Y\') 						ELSE DATE_FORMAT(FECHAMOVIMIENTO,\'%d/%m/%Y\') 					END AS FECHAMOVIMIENTO,

   					WEIGHT1,

   					U_SEI_FACTURAS,

   					TOTALUSD,

   					COSTOFLETE,

   					COSTOSANIDAD,

   					PORC_SMGZ,

   					PORC_ZAMBRANO,

   					INVERSIONTOTAL AS TOTALINVERSIONSEGUI,

   					COBRA_DC,

   					PORC_MUNICIPAL,

   					COBRAINVERSOR,

   					DATE_FORMAT(FECHADECOBRO,\'%d/%m/%Y\') AS FECHADECOBRO,

   					NROGUIA					/*					,CASE						SUM(NROCABEZAS) 						WHEN 0 						THEN \'Cerrado\' 						ELSE \'Abierto\' 					END AS STATUS					*/

   				  FROM

   					sei_rpt_seguimientos2

   				WHERE CODIGOSOCIO =  \'$identificacion\' 

   				AND DOCENTRY =  \'$docentry\' 

   				AND UPPER(TRIM(U_SEI_CONCEPTOS)) IN (

   					\'VENTA\',

   					\'MUERTE\',

   					\'NACIMIENTO\')

   				ORDER BY DATE(FECHAMOVIMIENTO) asc

   			";

        //$sql = mysql_escape_string($sql);

        //	echo $sql;exit;

        parent::__set("sql", $sql);

        $registros = parent::MET_Select();

        //            print_r($registros);exit;

        return $registros;
    } // end MET_consultaLibro

    function MET_fillTable2(
        $identificacion,
        $docentry,
        $cabinicial,
        $invInicial
    ) {
        $registros = $this->MET_consulta2($identificacion, $docentry);

        $cnt_total = 0;

        $val_costo = 0;

        $cob_inversor = 0;

        //$compra_inicial = 0;

        $inversion_inicial = 0;

        if (!$registros) {
            $this->filas =
                '<tr> 

       		<td><div align="center" colspan="5"> ' .
                $this->msj_query .
                '</div></td>

       				</tr>';
        } else {
            foreach ($registros as $ind => $reg) {
                if ($ind % 2 == 0) {
                    $etiq_tr = '<tr class="filapar_consulta"';
                } else {
                    $etiq_tr = '<tr class="filaimpar_consulta"';
                }

                if ($reg["U_SEI_CONCEPTOS"] == "COMPRAINICIAL") {
                    $val_1 = $reg["TOTALINVERSIONSEGUI"];
                } else {
                    $val_1 = 0;
                }

                $this->filas .=
                    '

   				<tr ' .
                    $etiq_tr .
                    '>

   				<td align=center>' .
                    $reg["FECHAMOVIMIENTO"] .
                    "</td>								<td align=center>" .
                    $reg["U_SEI_CONCEPTOS"] .
                    '</td>

   				<td align=center>' .
                    $reg["U_SEI_FACTURAS"] .
                    '</td>

   				<td align=center>' .
                    $reg["NROCABEZAS"] .
                    '</td>

   				<td style="display: none" align=center>' .
                    number_format($val_1, 2, ",", ".") .
                    "</td>								<td align=center>" .
                    number_format($reg["TOTALUSD"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    number_format($reg["COBRA_DC"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    number_format($reg["COBRAINVERSOR"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    $reg["FECHADECOBRO"] .
                    '</td>

     				</tr>

   				';

                $cnt_total += $reg["NROCABEZAS"];

                $cob_inversor += $reg["COBRAINVERSOR"];

                //	if($reg['U_SEI_CONCEPTOS']=="COMPRAINICIAL")

                //	{

                //$compra_inicial+=$reg['NROCABEZAS'];

                //$inversion_inicial+=$val_1;						//$status_inicial=$reg['STATUS'];

                //	}
            } //end foreach

            $cnt_total += $cabinicial; //$cob_inversor+=$invInicial;

            //$this->global_compra_inicial = $compra_inicial;

            //$this->global_inversion_inicial = $inversion_inicial;								//$this->global_status_inicial = $status_inicial;

            $this->filas .=
                '

   				<tr ' .
                $etiq_tr .
                '>

   				<td  align=left colspan = "3">' .
                "<b>SALDO CABEZAS</b>" .
                '</td>

   				<td align=center><b>' .
                $cnt_total .
                '</b></td>

     				</tr> 								';
            $this->filas .=
                "								<tr " .
                $etiq_tr .
                '>				<td  align=left colspan = "6">' .
                "<b>TOTAL A COBRAR CLIENTE</b>" .
                "</td>				<td align=center><b>" .
                number_format($cob_inversor, 2, ",", ".") .
                '</b></td>  				</tr>

   				';
        } //end if

        return $this->filas;
    } // end MET_fillCombo

    function MET_fillTable2_total($identificacion, $docentry)
    {
        $registros = $this->MET_consulta2_total($identificacion, $docentry);
        $cnt_total = 0;
        $val_costo = 0;
        $cob_inversor = 0;
        $compra_inicial = 0;
        $inversion_inicial = 0;
        $almacen_inicial = "";
		$fecha_inversion_inicial = "";
        if (!$registros) {
            $this->filas =
                '<tr> 				<td><div align="center" colspan="5"> ' .
                $this->msj_query .
                "</div></td>    			</tr>";
        } else {
            foreach ($registros as $ind => $reg2) {
                if ($reg2["U_SEI_CONCEPTOS"] == "COMPRAINICIAL") {
                    $val_1 = $reg2["TOTALINVERSIONSEGUI"];
                } else {
                    $val_1 = 0;
                }
                $cnt_total += $reg2["NROCABEZAS"];
                $compra_inicial += $reg2["NROCABEZAS"];
                $inversion_inicial += $val_1;
                $status_inicial = $reg2["STATUS"];
                $almacen_inicial = $reg2["NOMBALMACEN"];
				$fecha_inversion_inicial = $reg2["FECHAMOVIMIENTO"];
            }
            $this->global_compra_inicial = $compra_inicial;
            $this->global_inversion_inicial = $inversion_inicial;
            $this->global_status_inicial = $status_inicial;
            $this->global_almacen_inicial = $almacen_inicial;
			$this->global_fecha_inversion_inicial = $fecha_inversion_inicial;
        }
        return $this->filas;
    }

    /***************************************************************************************************/

    /***************************************************************************************************/

    /***************************************************************************************************/

    /***************************************************************************************************/

    /*									METODOS CONSULTA POR INVERSOR								   */

    /***************************************************************************************************/

    /***************************************************************************************************/

    function MET_consulta3($identificacion)
    {
        $sql = "

   					/* SELECT ALMACEN, NOMBALMACEN, DOCENTRY, SUM(NROCABEZAS) AS NROCABEZAS

   					FROM

   						sei_rpt_seguimientos2

   						WHERE CODIGOSOCIO = \'$identificacion\' 

   						GROUP BY ALMACEN, NOMBALMACEN, DOCENTRY

   						ORDER BY ALMACEN, NOMBALMACEN, DOCENTRY

   						*/

   					SELECT 

   					  DOCENTRY,					  					  STATUS AS ESTADO_NEGOCIO,					  /*

   					  CASE

   						SUM(NROCABEZAS) 

   						WHEN 0 

   						THEN \'Cerrado\' 

   						ELSE \'Abierto\' 

   					  END AS ESTADO_NEGOCIO,					  */

   					  NOMBALMACEN,

   					  PROPIETARIO,

   					  (SELECT 

   						TIPOCONTRATO 

   					  FROM

   						sei_rpt_seguimientos2 b 

   					  WHERE a.DOCENTRY = b.DOCENTRY 

   						AND a.CODIGOSOCIO = b.CODIGOSOCIO 

   						AND LENGTH(TRIM(TIPOCONTRATO)) > 0 

   					  LIMIT 1) AS TIPOCONTRATO,

   					  SUM(INVERSIONTOTAL) AS USD_TOTAL,												/*						(SUM(COBRA_DC) + SUM(COBRAINVERSOR)) AS USD_GENERADOS,						*/						

   					  (SUM(COBRAINVERSOR)) AS USD_GENERADOS,						

   					  (SELECT 

       (SUM(INVERSIONTOTAL))

     FROM

       sei_rpt_seguimientos2 b 

     WHERE UPPER(b.U_SEI_CONCEPTOS) = UPPER(\'CompraInicial\')

       AND a.DOCENTRY = b.DOCENTRY 

       AND a.CODIGOSOCIO = b.CODIGOSOCIO) AS USD_GENERADOS3,

   					  

   					  

   					  (SELECT 

   						COALESCE(SUM(COALESCE(b.NROCABEZAS, 0)), 0) 

   					  FROM

   						sei_rpt_seguimientos2 b 

   					  WHERE b.U_SEI_CONCEPTOS = \'CompraInicial\' 

   						AND a.DOCENTRY = b.DOCENTRY 

   						AND a.CODIGOSOCIO = b.CODIGOSOCIO) AS CABEZAS_COMPRADAS,

   					  (SELECT 

   						COALESCE(SUM(COALESCE(b.NROCABEZAS, 0)), 0) 

   					  FROM

   						sei_rpt_seguimientos2 b 

   					  WHERE b.U_SEI_CONCEPTOS = \'Venta\' 

   						AND a.DOCENTRY = b.DOCENTRY 

   						AND a.CODIGOSOCIO = b.CODIGOSOCIO) AS CABEZAS_VENDIDAS,

   					  SUM(NROCABEZAS) AS STOCK 

   					FROM

   					  sei_rpt_seguimientos2 a 

   					WHERE CODIGOSOCIO = \'$identificacion\'  

   					GROUP BY STATUS, ALMACEN,

   					  NOMBALMACEN,

   					  DOCENTRY , PROPIETARIO

   					ORDER BY ALMACEN,

   					  NOMBALMACEN,

   					  DOCENTRY 	

   						

   						

   			";

        //$sql = mysql_escape_string($sql);

        //		echo $sql;exit;

        parent::__set("sql", $sql);

        $registros = parent::MET_Select();

        //                        print_r($registros);exit;

        return $registros;
    } // end MET_consultaLibro

    function MET_fillTable3($identificacion)
    {
        $registros = $this->MET_consulta3($identificacion);

        $cnt_total = 0;

        $val_costo = 0;

        $inv_total = 0;

        $suma_2 = 0;

        if (!$registros) {
            $this->filas =
                '<tr> 

       		<td><div align="center" colspan="5"> ' .
                $this->msj_query .
                '</div></td>

       				</tr>';
        } else {
            foreach ($registros as $ind => $reg) {
                if ($ind % 2 == 0) {
                    $etiq_tr = '<tr class="filapar_consulta"';
                } else {
                    $etiq_tr = '<tr class="filaimpar_consulta"';
                }

                $this->filas .=
                    '

   				<tr ' .
                    $etiq_tr .
                    '>

   				<td align=center>' .
                    $reg["ESTADO_NEGOCIO"] .
                    '</td>

   				<td align=center>' .
                    $reg["NOMBALMACEN"] .
                    '</td>

   				<td align=center>' .
                    $reg["TIPOCONTRATO"] .
                    '</td>

   				<td align=center>' .
                    number_format($reg["USD_GENERADOS3"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    number_format($reg["USD_GENERADOS"], 2, ",", ".") .
                    '</td>

   				<td align=center>' .
                    $reg["CABEZAS_COMPRADAS"] .
                    '</td>

   				<td align=center>' .
                    $reg["CABEZAS_VENDIDAS"] .
                    '</td>

   				<td align=center>' .
                    $reg["STOCK"] .
                    '</td>

     				</tr>

   				';

                $cnt_total += $reg["STOCK"];

                $inv_total = $reg["USD_TOTAL"];

                $suma_2 += $reg["USD_GENERADOS3"];

                //	$val_costo+=$reg['val_costo'];
            } //end foreach

            $this->filas .=
                '

   				<tr ' .
                $etiq_tr .
                '>

   				<td align=right colspan = "3">' .
                "<b>TOTAL</b>" .
                '</td>

   				<td align=center><b>' .
                number_format($suma_2, 2, ",", ".") .
                '</b></td>

   				<td align=right colspan = "3">' .
                "<b>&nbsp;</b>" .
                '</td>

   				<td align=center><b>' .
                $cnt_total .
                '</b></td>

   				

   				

     				</tr>

   				';
        } //end if

        return $this->filas;
    } // end MET_fillCombo*/

    /***************************************************************************************************/

    /***************************************************************************************************/

    function MET_consulta2_total($identificacion, $docentry)
    {
        $sql = "				 SELECT					DICOSE,					TIPOCONTRATO,					LOCATION,					DOCNUM,					ALMACEN,					NOMBALMACEN,					NOMBRESOCIO,										UPPER(U_SEI_CONCEPTOS) AS U_SEI_CONCEPTOS,					NROCABEZAS,					CATEGORIA,					FECHAMOVIMIENTO,					WEIGHT1,					U_SEI_FACTURAS,					TOTALUSD,					COSTOFLETE,					COSTOSANIDAD,					PORC_SMGZ,					PORC_ZAMBRANO,					INVERSIONTOTAL AS TOTALINVERSIONSEGUI,					COBRA_DC,					PORC_MUNICIPAL,					COBRAINVERSOR,					FECHADECOBRO,					NROGUIA,										STATUS					/*					CASE						SUM(NROCABEZAS) 						WHEN 0 						THEN \'Cerrado\' 						ELSE \'Abierto\' 					  END AS STATUS					*/				  FROM					sei_rpt_seguimientos2				WHERE CODIGOSOCIO =  \'$identificacion\' 				AND DOCENTRY =  \'$docentry\' 				AND UPPER(TRIM(U_SEI_CONCEPTOS)) IN (					\'COMPRAINICIAL\')				ORDER BY FECHAMOVIMIENTO asc, 1, 2, 3			";
        parent::__set("sql", $sql);
        $registros = parent::MET_Select();
        return $registros;
    }
} //end class

?>