Beispiel #1
0
        private void Inicializar()
        {
            kilo    = (bool)Session["Kilos"];
            bultos  = (bool)Session["Bultos"];
            neto    = (bool)Session["Neto"];
            retiro  = (bool)Session["Retiro"];
            entrega = (bool)Session["Entrega"];
            total   = (bool)Session["TotalGuias"];


            DsReporteAgenciaFacturacion ds = new DsReporteAgenciaFacturacion();

            ds    = (DsReporteAgenciaFacturacion)Session["DsReporte"];
            Datos = new DataTable();
            Datos.Columns.Add("AgenciaID");
            Datos.Columns.Add("RazonSocial");
            Datos.Columns.Add("Kilos");
            Datos.Columns.Add("Bultos");
            Datos.Columns.Add("Neto");
            Datos.Columns.Add("Retiro");
            Datos.Columns.Add("Entrega");
            Datos.Columns.Add("TotalGuias");
            Datos = ds.Datos;

            this.Title = "Reporte facturación de agencia";
            CustomExport();
        }
        private void BindGrid(bool AgrupadoAgOrigen)
        {
            DataSet ds = new DataSet();

            SisPackController.AdministrarGrillas.Configurar(this.hgAgencias, "AgenciaID", this.CantidadOpciones);

            IReporteFacturacionAgencia oReporte = ReporteFacturacionAgenciaFactory.GetReporteFacturacionAgencia();

            string   ListaAgenciaOrigen  = getListaAg(chkAgenciaTodas, lstAgencia);
            string   ListaAgenciaDestino = getListaAg(chkAgenciaDestinoTodas, lstAgenciaDestino);
            DateTime FechaDesde          = this.txtFecha.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFecha.Text) : Utiles.Fechas.FormatFechaDDMMYYYY("01/01/1900"),
                     FechaHasta          = this.txtFechaHasta.Text != "" ? Utiles.Fechas.FormatFechaDDMMYYYY(this.txtFechaHasta.Text) : DateTime.Today;

            DsReporteAgenciaFacturacion dsagencias = oReporte.ObtenerReporteFecturacion(ListaAgenciaOrigen, ListaAgenciaDestino, FechaDesde, FechaHasta, AgrupadoAgOrigen);

            ds.Tables.Add(dsagencias.Datos.Clone());
            ds.Tables[0].TableName = "AgenciaPrincipal";
            foreach (System.Data.DataRow row in dsagencias.Datos.Rows)
            {
                ds.Tables["AgenciaPrincipal"].ImportRow(row);
            }

            ds.Tables.Add(dsagencias.Agencias.Clone());
            ds.Tables[1].TableName = "AgenciaSecundaria";
            foreach (System.Data.DataRow row in dsagencias.Agencias.Rows)
            {
                ds.Tables["AgenciaSecundaria"].ImportRow(row);
            }

            //Relacion Agencia-AgenciaSecundaria
            DataColumn dc1  = ds.Tables["AgenciaPrincipal"].Columns["AgenciaID"],
                       dc2  = ds.Tables["AgenciaSecundaria"].Columns["AgenciaID"];
            DataRelation dr = new DataRelation("AgenciaPrincipal_AgenciaSecundaria", dc1, dc2, false);

            ds.Relations.Add(dr);

            //Session["ReporteAgenciaFacturacion"] = dsagencias;
            Session["DsReporte"] = dsagencias;
            bool kilo, bultos, neto, retiro, entrega, total;

            Session["Kilos"]           = this.chkColumnasGrilla.Items.FindByValue("colKilos").Selected;
            Session["Bultos"]          = this.chkColumnasGrilla.Items.FindByValue("colBultos").Selected;
            Session["Neto"]            = this.chkColumnasGrilla.Items.FindByValue("colNeto").Selected;
            Session["Retiro"]          = this.chkColumnasGrilla.Items.FindByValue("colRetiro").Selected;
            Session["Entrega"]         = this.chkColumnasGrilla.Items.FindByValue("colEntrega").Selected;
            Session["TotalGuias"]      = this.chkColumnasGrilla.Items.FindByValue("colTotalGuias").Selected;
            this.hgAgencias.DataSource = ds;
            this.hgAgencias.DataMember = "AgenciaPrincipal";
            this.hgAgencias.DataBind();
            OcultarColumnas();
        }
        public DsReporteAgenciaFacturacion ObtenerReporteFecturacion(string AgenciasOrigen, string AgenciaDestino, DateTime fechaDesde, DateTime fechaHasta, bool tipo)
        {
            DsReporteAgenciaFacturacion ds = new DsReporteAgenciaFacturacion();


            SqlParameter pAgencia        = new SqlParameter("@AgenciaID", AgenciasOrigen);
            SqlParameter pFechaDesde     = new SqlParameter("@FechaInicio", fechaDesde);
            SqlParameter pFechaHasta     = new SqlParameter("@FechaFin", fechaHasta);
            SqlParameter pTipo           = new SqlParameter("@Tipo", tipo);
            SqlParameter pAgenciaDestino = new SqlParameter("@AgenciaDestinoID", AgenciaDestino);

            Config.Conexion.LlenarTypeDataSet(ds.Datos, System.Data.CommandType.StoredProcedure,
                                              "FacturacionAgenciaSel", pAgencia, pAgenciaDestino, pFechaDesde, pFechaHasta, pTipo);
            Config.Conexion.LlenarTypeDataSet(ds.Agencias, System.Data.CommandType.StoredProcedure,
                                              "FacturacionAgenciaDetalleSel", pAgencia, pAgenciaDestino, pFechaDesde, pFechaHasta, pTipo);

            return(ds);
        }
Beispiel #4
0
        protected DataTable GetDetalle(int AgenciaID)
        {
            DsReporteAgenciaFacturacion ds = (DsReporteAgenciaFacturacion)Session["DsReporte"];

            DataTable dt = new DataTable();

            DataSet Detalle = new DataSet();

            Detalle.Tables.Add();
            Detalle.Tables[0].Columns.Add("AgenciaRelacionadaID");
            Detalle.Tables[0].Columns.Add("RazonSocial");
            Detalle.Tables[0].Columns.Add("Kilos");
            Detalle.Tables[0].Columns.Add("Bultos");
            Detalle.Tables[0].Columns.Add("Neto");
            Detalle.Tables[0].Columns.Add("Retiro");
            Detalle.Tables[0].Columns.Add("Entrega");
            Detalle.Tables[0].Columns.Add("TotalGuias");

            int i = 0;

            foreach (DsReporteAgenciaFacturacion.AgenciasRow dr in ds.Agencias)
            {
                if (Convert.ToInt32(ds.Agencias.Rows[i]["AgenciaID"]) == AgenciaID)
                {
                    DataRow drDetalle = Detalle.Tables[0].NewRow();
                    drDetalle["AgenciaRelacionadaID"] = dr.AgenciaRelacionadaID;
                    drDetalle["RazonSocial"]          = dr.RazonSocial;
                    drDetalle["Kilos"]      = dr.Kilos;
                    drDetalle["Bultos"]     = dr.Bultos;
                    drDetalle["Neto"]       = dr.Neto;
                    drDetalle["Retiro"]     = dr.Retiro;
                    drDetalle["Entrega"]    = dr.Entrega;
                    drDetalle["TotalGuias"] = dr.TotalGuias;
                    Detalle.Tables[0].Rows.Add(drDetalle);
                }
                i++;
            }
            // devuelvo un dataTable vacío, para que no se llenen los campos del detalle
            return(Detalle.Tables[0]);
        }