コード例 #1
0
        private void dtgLiquidaciones_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            // formateo los datos de importes
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //
            }
            else if (e.Item.ItemType == ListItemType.Footer)
            {
                DsLiquidacionVentaWeb ds = new DsLiquidacionVentaWeb();
                ds = (DsLiquidacionVentaWeb)Session["dsLiquidacion"];

                double totalComisVenta   = Convert.ToDouble(ds.Datos.Compute("SUM(ImporteComisionVenta)", ""));
                double totalComisCom     = Convert.ToDouble(ds.Datos.Compute("SUM(ImporteComisionComercializacion)", ""));
                double totalComisRet     = Convert.ToDouble(ds.Datos.Compute("SUM(ImporteRedistribucion)", ""));
                double totalImporteFlete = Convert.ToDouble(ds.Datos.Compute("SUM(ImporteTotalFlete)", ""));

                e.Item.Cells[2].Text      = Utiles.Formatos.Importe(totalComisVenta);
                e.Item.Cells[2].Font.Bold = true;

                e.Item.Cells[3].Text      = Utiles.Formatos.Importe(totalComisCom);
                e.Item.Cells[3].Font.Bold = true;

                e.Item.Cells[4].Text      = Utiles.Formatos.Importe(totalComisRet);
                e.Item.Cells[4].Font.Bold = true;

                e.Item.Cells[5].Text      = Utiles.Formatos.Importe(totalImporteFlete);
                e.Item.Cells[5].Font.Bold = true;
            }
        }
コード例 #2
0
        public DsLiquidacionVentaWeb GetLiquidacionVentaWebDataSet()
        {
            DsLiquidacionVentaWeb dsVenta = new DsLiquidacionVentaWeb();

            SqlParameter fDesde = new SqlParameter("@FechaEmisionDesde", Utiles.BaseDatos.FechaToSql(this.LiquidacionFechaDesde));
            SqlParameter fHasta = new SqlParameter("@FechaEmisionHasta", Utiles.BaseDatos.FechaToSql(this.LiquidacionFechaHasta));

            /*primero verifico el importe de facturacion*/
            Config.Conexion.LlenarTypeDataSet(dsVenta.ImportePeriodo, System.Data.CommandType.StoredProcedure,
                                              "ImporteFleteFacturadoWebSel", fDesde, fHasta);

            if (dsVenta.ImportePeriodo.Count > 0)
            {
                DsLiquidacionVentaWeb.ImportePeriodoRow dr;
                dr = (DsLiquidacionVentaWeb.ImportePeriodoRow)dsVenta.ImportePeriodo.Rows[0];

                SqlParameter porcVentas   = new SqlParameter("@PorcentajeVentas", dr.PorcentajeComisionVenta);
                SqlParameter porcComerc   = new SqlParameter("@PorcentajeComercializacion", dr.PorcentajeComercializacion);
                SqlParameter porcRedistri = new SqlParameter("@PorcentajeRedistribucion", dr.PorcentajeRedistribucion);

                Config.Conexion.LlenarTypeDataSet(dsVenta.Datos, System.Data.CommandType.StoredProcedure,
                                                  "LiquidacionVentaWebSEL", fDesde, fHasta, porcVentas, porcComerc, porcRedistri);
            }

            return(dsVenta);
        }
コード例 #3
0
 private void LlenarGrilla(DsLiquidacionVentaWeb dsLiquidacion, int currentPage)
 {
     SisPackController.AdministrarGrillas.Configurar(dtgLiquidaciones, "GuiaID", this.CantidadOpciones, true, true);
     Session["dsLiquidacion"]               = dsLiquidacion;
     this.dtgLiquidaciones.DataSource       = dsLiquidacion;
     this.dtgLiquidaciones.CurrentPageIndex = currentPage;
     this.dtgLiquidaciones.DataBind();
 }
コード例 #4
0
        public bool GuardarVentaWeb(DsLiquidacionVentaWeb dsLiquidacion)
        {
            DsLiquidacionVentaWeb.DatosRow          drLiqWeb;
            DsLiquidacionVentaWeb.ImportePeriodoRow drLiqWebEnc;
            LiquidacionWebDetalle liquidacionDetalle;            //detalle
            LiquidacionWebDetalleConceptoFacturable concepto;    //conceptoFacturable

            using (SqlConnection conexion = new SqlConnection())
            {
                SqlTransaction transaccion = null;
                conexion.ConnectionString = Config.ConnectionString;
                try
                {
                    conexion.Open();
                    //para trabajar con transaccion
                    transaccion = conexion.BeginTransaction();

                    /*escribir
                     * 1º encabezado en LiquidacionWeb
                     * 2º el detalle de las guias en LiquidacionWebDetalle
                     * 3º los conceptos facturables de las guias*/

                    //en el encabezado se necesita guardar los valores de los procentajes

                    drLiqWeb    = (DsLiquidacionVentaWeb.DatosRow)dsLiquidacion.Datos.Rows[0];                   //para el detalle
                    drLiqWebEnc = (DsLiquidacionVentaWeb.ImportePeriodoRow)dsLiquidacion.ImportePeriodo.Rows[0]; //para el encabezado
                    this.PorcentajeComercializacion      = drLiqWebEnc.PorcentajeComercializacion;
                    this.PorcentajeComisionVenta         = drLiqWebEnc.PorcentajeComisionVenta;
                    this.PorcentajeRedistribucionSispack = drLiqWebEnc.PorcentajeRedistribucion;
                    Guardar(transaccion);                    //guardo el encabezado
                    for (int i = 0; i <= (dsLiquidacion.Datos.Rows.Count) - 1; i++)
                    {
                        drLiqWeb           = (DsLiquidacionVentaWeb.DatosRow)dsLiquidacion.Datos.Rows[i];
                        liquidacionDetalle = new LiquidacionWebDetalle();
                        liquidacionDetalle.LiquidacionWebID = this.LiquidacionWebID;
                        liquidacionDetalle.GuiaID           = drLiqWeb.GuiaID;
                        liquidacionDetalle.Guardar(transaccion);
                        float flete = drLiqWeb.ImporteTotalFlete;
                        concepto = new LiquidacionWebDetalleConceptoFacturable();
                        concepto.ImporteComisionVenta     = drLiqWebEnc.PorcentajeComisionVenta * flete / 100;                   /*porcentaje por el flete*/
                        concepto.ImporteComercializacion  = drLiqWebEnc.PorcentajeComercializacion * flete / 100;
                        concepto.ImporteRedistribucion    = drLiqWebEnc.PorcentajeRedistribucion * concepto.ImporteComisionVenta / 100;
                        concepto.LiquidacionWebConceptoID = drLiqWeb.LiquidacionWebConceptoID;
                        concepto.LiquidacionWebDetalleID  = liquidacionDetalle.LiquidacionWebDetalleID;
                        concepto.Guardar(transaccion);
                    }
                    transaccion.Commit();
                    return(true);
                }
                catch (Exception ex)
                {
                    transaccion.Rollback();
                    throw ex;
                }
            }
        }
コード例 #5
0
        private void butConfirmar_Click(object sender, System.EventArgs e)
        {
            /*confirma la liquidacion*/
            try
            {
                if (Session["dsLiquidacion"] != null)
                {
                    DsLiquidacionVentaWeb liquidacion = (DsLiquidacionVentaWeb)Session["dsLiquidacion"];


                    /*por cada liquidacion de la grilla guardo el encabezado y detalle*/
                    ILiquidacionWeb liq = LiquidacionWebFactory.GetLiquidacionWebFactory();
                    liq.LiquidacionFechaDesde = Utiles.Fechas.FormatFechaDDMMYYYY(txtFechaDesde.Text);
                    liq.LiquidacionFechaHasta = Utiles.Fechas.FormatFechaDDMMYYYY(txtFechaHasta.Text);
                    liq.ImporteFleteFacturado = (float)Utiles.Validaciones.obtieneDouble(txtFleteTotalFacturado.Text);
                    liq.EsWeb = true;
                    if (liq.GuardarVentaWeb(liquidacion))

                    {
                        FechaAlta = liq.LiquidacionFecha;
                        NroLiq    = liq.LiquidacionNro;

                        string reporte      = ExportarPDF();
                        string scriptString = "<script language='javascript'>\n";
                        scriptString += "window.open('VerPlanilla.aspx?id=" + reporte + "', '', 'width=0,height=0,status=no,scrollbars=yes,resizable=yes');\n";
                        scriptString += "</script>\n";
                        Page.RegisterStartupScript("scriptOpen", scriptString);
                        BindGrid(0);
                        Session["dsLiquidacion"]  = null;
                        this.butConfirmar.Enabled = false;
                    }
                    else
                    {
                        string script = "<script language='javascript'>\n";
                        script += "alert('Los datos no se guardaron debido a errores.');\n";
                        script += "</script>";

                        Page.RegisterStartupScript("scriptError", script);
                        Session["dsLiquidacion"] = null;
                    }
                }
                else
                {
                    throw new Exception("Deben existir guías para poder liquidar el período");
                }
            }
            catch (Exception ex)
            {
                ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message);
            }
        }
コード例 #6
0
        private void BindGrid(int currentPage)
        {
            string debug = "";

            try
            {
                ILiquidacionWeb liquidacion = LiquidacionWebFactory.GetLiquidacionWebFactory();
                liquidacion.LiquidacionFechaDesde = Utiles.Fechas.FormatFechaDDMMYYYY(txtFechaDesde.Text);
                liquidacion.LiquidacionFechaHasta = Utiles.Fechas.FormatFechaDDMMYYYY(txtFechaHasta.Text);

                DsLiquidacionVentaWeb dsLiquidacion = liquidacion.GetLiquidacionVentaWebDataSet();;
                if (dsLiquidacion.Datos.Rows.Count > 0)
                {
                    if (dsLiquidacion.ImportePeriodo.Count > 0)
                    {
                        DsLiquidacionVentaWeb.ImportePeriodoRow dr = (DsLiquidacionVentaWeb.ImportePeriodoRow)dsLiquidacion.ImportePeriodo.Rows[0];
                        txtFleteTotalFacturado.Text = dr.ImporteFleteTotal.ToString();
                        txtComisionesWebID.Text     = dr.IsComisionesWebIDNull()? "0" : dr.ComisionesWebID.ToString();

                        BindGridComisiones();
                    }

                    LlenarGrilla(dsLiquidacion, currentPage);
                    if (dsLiquidacion.Datos.Count > 0)
                    {
                        butConfirmar.Enabled = true;
                    }
                }
                else
                {
                    // TODO: visualizar que no hay datos para liquidar en el poeriodo ingresado
                }
            }
            catch (Exception ex)
            {
                ((ErrorWeb)phErrores.Controls[0]).setMensaje(ex.Message + " " + debug);
            }
        }