Ejemplo n.º 1
0
        public void ListenerAfterFlush(object sender)
        {
            object _tasksender = sender;

            if (((ITask)_tasksender).GetTaskName().CompareTo(this._dataFromTask) == 0)
            {
                GetDataFromClass(sender);
            }
            else
            {
                if (_tasksender is mz.erp.businessrules.GenerateCollectionCommonTasks)
                {
                    GenerateCollectionCommonTasks classcollection = (GenerateCollectionCommonTasks)sender;
                    foreach (object subtask in classcollection)
                    {
                        if (((ITask)subtask).GetTaskName().CompareTo(this._dataFromTask) == 0)
                        {
                            GetDataFromClass(subtask);
                        }
                    }
                }
            }

            /*	if(this._processManager.Process.ProcessName.Equals("ProcesoConsultarStockNDiasIngresarPreOrdenDeCompra"))
             *      {
             *              if(sender.GetType().Equals(typeof(mz.erp.businessrules.comprobantes.ComprobanteDeCompra)))
             *              {
             *                      mz.erp.businessrules.comprobantes.ComprobanteDeCompra cc = (mz.erp.businessrules.comprobantes.ComprobanteDeCompra)sender;
             *                      DataTable table = _dataSource.Table;
             *                      table = AddColumn.AddColumnToTable(table, "Numero", cc.Numero);
             *                      _dataSource = table.DefaultView;
             *              }
             *      }
             */
            if (this._processManager.Process.ProcessName.Equals("ProcesoPagarCompras"))
            {
                if (sender.GetType().Equals(typeof(mz.erp.businessrules.IngresarComprobanteDePagoCompras)))
                {
                    IngresarComprobanteDePagoCompras snd = (IngresarComprobanteDePagoCompras)sender;
                    string IdComprobante     = snd.IdComprobante;
                    string IdTipoDeRetencion = Variables.GetValueString(this._processManager.Process.ProcessName, this.GetTaskName(), "TipoDeRetencion");
                    if (snd.HayRetenciones(IdTipoDeRetencion))
                    {
                        DataSet   data          = tpu_RetencionesEx.GetListEx(IdComprobante, IdTipoDeRetencion);
                        DataTable table         = data.Tables[0];
                        string    nombreEmpresa = Variables.GetValueString("Sistema.NombreEmpresa");
                        table = AddColumn.AddColumnToTable(table, "NombreEmpresa", nombreEmpresa);
                        string domicilioEmpresa = Variables.GetValueString("Sistema.DireccionEmpresa");
                        table = AddColumn.AddColumnToTable(table, "DomicilioEmpresa", domicilioEmpresa);
                        string cuitEmpresa = Variables.GetValueString("Sistema.CUITEmpresa");
                        table       = AddColumn.AddColumnToTable(table, "CUITEmpresa", cuitEmpresa);
                        _dataSource = table.DefaultView;
                    }
                    else
                    {
                        _allowShow = false;
                    }
                }
            }

            if (this._processManager.Process.ProcessName.Equals("ProcesoModificarPrecioProducto"))
            {
                if (sender.GetType().Equals(typeof(mz.erp.businessrules.IngresarPrecioProducto)))
                {
                    IngresarPrecioProducto snd = (IngresarPrecioProducto)sender;
                    DataTable  table           = new DataTable("TablaResultadoProcesoModificarPrecioProducto");
                    DataColumn col0            = new DataColumn("IdListaDePrecio", typeof(string));
                    table.Columns.Add(col0);
                    DataColumn col1 = new DataColumn("ListaDePrecios", typeof(string));
                    table.Columns.Add(col1);
                    DataColumn col2 = new DataColumn("Codigo", typeof(string));
                    table.Columns.Add(col2);
                    DataColumn col3 = new DataColumn("CodigoSecundario", typeof(string));
                    table.Columns.Add(col3);
                    DataColumn col4 = new DataColumn("Descripcion", typeof(string));
                    table.Columns.Add(col4);
                    DataColumn col5 = new DataColumn("PrecioCostoDirecto", typeof(decimal));
                    table.Columns.Add(col5);
                    DataColumn col6 = new DataColumn("PrecioDeCostoIndirecto", typeof(decimal));
                    table.Columns.Add(col6);
                    DataColumn col7 = new DataColumn("PrecioDeCostoRef", typeof(decimal));
                    table.Columns.Add(col7);
                    DataColumn col8 = new DataColumn("MAC", typeof(decimal));
                    table.Columns.Add(col8);
                    DataColumn col9 = new DataColumn("PrecioDeVentaNeto", typeof(decimal));
                    table.Columns.Add(col9);
                    DataColumn col10 = new DataColumn("PrecioDeVentaBruto", typeof(decimal));
                    table.Columns.Add(col10);
                    DataColumn col11 = new DataColumn("PrecioDeVentaBrutoConImpuesto", typeof(decimal));
                    table.Columns.Add(col11);
                    DataColumn col12 = new DataColumn("Coeficiente", typeof(decimal));
                    table.Columns.Add(col12);
                    DataColumn col13 = new DataColumn("MaxDescuento", typeof(decimal));
                    table.Columns.Add(col13);
                    DataColumn col14 = new DataColumn("MaxDescuentoPorcentual", typeof(decimal));
                    table.Columns.Add(col14);

                    if (snd.ListaDePreciosHabilitadas)
                    {
                        foreach (Producto prod in snd.Productos)
                        {
                            foreach (ListaDePreciosItem item in prod.ListaDePrecios.Items)
                            {
                                DataRow rowLP  = mz.erp.businessrules.tsh_ListasDePrecios.GetByPk(item.IdListaDePrecios);
                                string  descLP = (string)rowLP["Descripcion"];
                                DataRow row    = table.NewRow();
                                row["IdListaDePrecio"]        = item.IdListaDePrecios;
                                row["ListaDePrecios"]         = descLP;
                                row["Codigo"]                 = prod.Codigo;
                                row["CodigoSecundario"]       = prod.CodigoSecundario;
                                row["Descripcion"]            = prod.Descripcion;
                                row["PrecioCostoDirecto"]     = prod.PrecioDeCostoAnterior;
                                row["PrecioDeCostoIndirecto"] = prod.CostosIndirectos;
                                row["PrecioDeCostoRef"]       = prod.PrecioDeCosto;
                                row["MAC"] = prod.MAC;
                                row["PrecioDeVentaNeto"] = prod.PrecioDeVentaNeto;
                                tsh_ProductosListasDePreciosDataset.tsh_ProductosListasDePreciosRow rowPLP = tsh_ProductosListasDePrecios.GetByPk(prod.IdProducto, item.IdListaDePrecios);
                                row["PrecioDeVentaBruto"]            = rowPLP.PrecioDeVentaBruto;
                                row["PrecioDeVentaBrutoConImpuesto"] = rowPLP.PrecioDeVentaBrutoConImpuesto;
                                row["Coeficiente"]            = rowPLP.Coeficiente;
                                row["MaxDescuento"]           = rowPLP.MaxDescuento;
                                row["MaxDescuentoPorcentual"] = rowPLP.MaxDescuentoPorcentual;
                                table.Rows.Add(row);
                            }
                        }
                        DataView dv = table.DefaultView;
                        dv.Sort     = "IdListaDePrecio";
                        _dataSource = dv;
                    }
                    else
                    {
                        foreach (Producto prod in snd.Productos)
                        {
                            DataRow rowLP  = mz.erp.businessrules.tsh_ListasDePrecios.GetByPk(prod.ListaDePrecios.GetDefaultItem().IdListaDePrecios);
                            string  descLP = (string)rowLP["Descripcion"];
                            DataRow row    = table.NewRow();
                            row["ListaDePrecios"]   = descLP;
                            row["Codigo"]           = prod.Codigo;
                            row["CodigoSecundario"] = prod.CodigoSecundario;
                            row["Descripcion"]      = prod.Descripcion;
                            //Sabrina: tarea 56
                            //row["PrecioCostoDirecto"] = prod.PrecioDeCostoAnterior;
                            row["PrecioDeCostoIndirecto"] = prod.CostosIndirectos;
                            row["PrecioCostoDirecto"]     = prod.PrecioDeCostoDirecto;
                            row["PrecioDeCostoRef"]       = prod.PrecioDeCosto;
                            row["MAC"] = prod.MAC;
                            row["PrecioDeVentaNeto"] = prod.PrecioDeVentaNeto;
                            ListaDePreciosItem item = prod.ListaDePrecios.GetDefaultItem();
                            row["PrecioDeVentaBruto"]            = item.PrecioDeVentaBruto;
                            row["PrecioDeVentaBrutoConImpuesto"] = item.PrecioDeVentaBrutoConImpuestos;
                            row["Coeficiente"]            = item.CoeficienteGral;
                            row["MaxDescuento"]           = item.MaxDescuento;
                            row["MaxDescuentoPorcentual"] = item.PorcentajeMaximoDescuento;
                            table.Rows.Add(row);
                        }
                        _dataSource = table.DefaultView;
                    }
                }
            }
            if ((_tasksender is mz.erp.businessrules.comprobantes.ComprobanteDePago)
                &&
                (this._processManager.Process.ProcessName.Equals("ProcesoPagar") ||
                 this._processManager.Process.ProcessName.Equals("ProcesoPagoACuentaDV") ||
                 this._processManager.Process.ProcessName.Equals("ProcesoDevolverPago") ||
                 this._processManager.Process.ProcessName.Equals("ProcesoDevolverPagoDV")
                )
                )

            {
                ComprobanteDePago comp  = (ComprobanteDePago)_tasksender;
                decimal           Total = 0;
                string            IdComprobanteDePago = null;
                foreach (DataRow row  in comp.DatasetComprobante.tsa_Comprobantes.Rows)
                {
                    if (Convert.ToString(row["IdTipoDeComprobante"]).Equals(comp.TipoComprobanteDestino))
                    {
                        IdComprobanteDePago = Convert.ToString(row["IdComprobante"]);
                        Total = Convert.ToDecimal(row["Total"]);
                        break;
                    }
                }
                DataTable table = mz.erp.businessrules.tsa_Comprobantes.GetComprobanteDePagoView(IdComprobanteDePago);

                string moneda = tfi_Monedas.GetDescripcionMoneda(comp.IdMonedaCierre);

                string textoNumeros = NumberToText.NumberToWords(Total, moneda);

                string nombreEmpresa = Variables.GetValueString("Sistema.NombreEmpresa");
                table = AddColumn.AddColumnToTable(table, "NombreEmpresa", nombreEmpresa);
                string domicilioEmpresa = Variables.GetValueString("Sistema.DireccionEmpresa");
                table = AddColumn.AddColumnToTable(table, "DomicilioEmpresa", domicilioEmpresa);
                string cuitEmpresa = Variables.GetValueString("Sistema.CUITEmpresa");
                table = AddColumn.AddColumnToTable(table, "CUITEmpresa", cuitEmpresa);



                foreach (DataRow row in table.Rows)
                {
                    row["TextoTotal"] = textoNumeros;
                }



                _dataSource = table.DefaultView;
            }
        }
Ejemplo n.º 2
0
 private void LoadFromIngresarPrecioProducto(IngresarPrecioProducto ing)
 {
 }