示例#1
0
        public void cargar_cobranzas(string ncontrato)
        {
            dtgCCanceladas.DataSource = null;
            dtgCPendientes.DataSource = null;
            txtTotCanCobranzas.Text   = "";
            txtGLCobranzas.Text       = "";
            txtICCobranzas.Text       = "";
            txtGICobranzas.Text       = "";
            txtFECobranzas.Text       = "";
            txtTGCobranzas.Text       = "";
            txtObsCobranzas.Text      = "";
            double TC, GL, IC, GI, FE, TG;

            TC = GL = IC = GI = FE = TG = 0;
            lblNContratoCobranzas.Text = "Contrato N° " + ncontrato;
            string txtSQL = "Select TipoCuota,NroCuota,TotalCuotas,MontoCuota,FechaCuota from Giros where NroContrato='" + ncontrato + "' and Estatus='PENDIENTE' Order by FechaCuota,TotalCuotas";

            if (Globales.BD.nregistros(txtSQL) > 0)
            {
                Globales.BD.dtt           = Globales.BD.generar_datatable(txtSQL, CommandType.Text, new List <Clases.Parameters>());
                dtgCPendientes.DataSource = Globales.BD.dtt;
                //dtgCPendientes.Columns[4].Visible = false;
                foreach (DataRow row in Globales.BD.dtt.Rows)
                {
                    if (row["TipoCuota"] != DBNull.Value)
                    {
                        if (Convert.ToString(row["TipoCuota"]) == "GIRO")
                        {
                            GI += Convert.ToDouble(row["MontoCuota"]);
                        }

                        else if (Convert.ToString(row["TipoCuota"]) == "COMPLEMENTARIA")
                        {
                            IC += Convert.ToDouble(row["MontoCuota"]);
                        }
                        else if (Convert.ToString(row["TipoCuota"]) == "GASTOSLEGALES")
                        {
                            GL += Convert.ToDouble(row["MontoCuota"]);
                        }
                        else if (Convert.ToString(row["TipoCuota"]).Length > 21)
                        {
                            if (Convert.ToString(row["TipoCuota"]).Substring(0, 21) == "FINANCIAMIENTOESPECIAL")
                            {
                                FE += Convert.ToDouble(row["MontoCuota"]);
                            }
                        }
                    }
                    TG += Convert.ToDouble(row["MontoCuota"]);
                }
                txtGLCobranzas.Text = GL.ToString("N2") + " Bs.";
                txtICCobranzas.Text = IC.ToString("N2") + " Bs.";
                txtGICobranzas.Text = GI.ToString("N2") + " Bs.";
                txtFECobranzas.Text = FE.ToString("N2") + " Bs.";
                txtTGCobranzas.Text = TG.ToString("N2") + " Bs.";
            }

            txtSQL = "Select TipoCuota,NroCuota,TotalCuotas,MontoCuota,FechaCancelado from Giros where NroContrato='" + ncontrato + "' and Estatus='CANCELADO' Order by FechaCuota,TotalCuotas";
            if (Globales.BD.nregistros(txtSQL) > 0)
            {
                Globales.BD.dtt           = Globales.BD.generar_datatable(txtSQL, CommandType.Text, new List <Clases.Parameters>());
                dtgCCanceladas.DataSource = Globales.BD.dtt;
                //dtgCCanceladas.Columns[4].Visible = false;

                foreach (DataRow row in Globales.BD.dtt.Rows)
                {
                    TC += Convert.ToDouble(row["MontoCuota"]);
                }
                txtTotCanCobranzas.Text = TC.ToString("N2") + " Bs.";
            }
        }