Esempio n. 1
0
        public void addFila(BE.ClsVenta venta)
        {
            try
            {
                DataRow dr = data.NewRow();
                int     i  = 0;
                foreach (var _property in venta.GetType().GetProperties())
                {
                    var prop = venta.GetType().GetProperty(_property.Name);
                    dr[i] = prop.GetValue(venta, null);

                    //prop.SetValue(_material, prop.GetValue(_material, null).ToString().ToUpper());
                    i++;
                }
                data.Rows.Add(dr);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
        public void add(DataRow rowAIG)
        {
            try
            {
                DateTime fecha;
                Double   admin            = 0.00;
                Double   intereses        = 0.00;
                Double   interesesMora    = 0.00;
                Double   interesesMora0   = 0.00;
                Double   reserva          = 0.00;
                Double   gastosInsolutos  = 0.00;
                Double   gastosFunerarios = 0.00;
                Double   total            = 0.00;

                if (DateTime.TryParse(rowAIG[0].ToString().Trim(), out fecha))
                {
                    BE.ClsVenta venta = new BE.ClsVenta();

                    venta.Docto           = "CFACE-1";
                    venta.DispElectronico = "001";
                    venta.AnioEmision     = 0;
                    venta.Moneda          = "GTQ";
                    venta.TasadeCambio    = 1;
                    venta.CodigoArticulo  = 1;
                    venta.UnidadMedida    = "UNIDAD";
                    venta.Cantidad        = 1;
                    venta.Descuento       = 0;
                    venta.BienOServicio   = 1; //0 = Bien o 1 = servicio
                    venta.Excento         = 0;

                    venta.fecha       = DateTime.Parse(rowAIG[0].ToString().Trim()).ToString("dd/MM/yyyy");
                    venta.Serie       = rowAIG[1].ToString();
                    venta.Correlativo = int.Parse(rowAIG[2].ToString().Trim());

                    if (rowAIG[3].ToString().Equals(""))
                    {
                        venta.NITBeneficiario = "C/F";
                    }
                    else
                    {
                        venta.NITBeneficiario = rowAIG[3].ToString();
                    }
                    venta.ClienteNombre = rowAIG[4].ToString();
                    //MessageBox.Show("valor: " + rowAIG[5].ToString().Trim());
                    admin  = rowAIG[5].ToString().Equals("") ? 0 : Double.Parse(rowAIG[5].ToString());
                    admin += (admin * 0.12);

                    intereses  = rowAIG[6].ToString().Equals("") ? 0 : Double.Parse(rowAIG[6].ToString());
                    intereses += (intereses * 0.12);

                    interesesMora  = rowAIG[7].ToString().Equals("") ? 0 : Double.Parse(rowAIG[7].ToString());
                    interesesMora += (interesesMora * 0.12);

                    interesesMora0  = rowAIG[8].ToString().Equals("") ? 0 : Double.Parse(rowAIG[8].ToString());
                    interesesMora0 += (interesesMora0 * 0.12);

                    reserva  = rowAIG[9].ToString().Equals("") ? 0 : Double.Parse(rowAIG[9].ToString());
                    reserva += (reserva * 0.12);

                    gastosFunerarios  = rowAIG[10].ToString().Equals("") ? 0 : Double.Parse(rowAIG[10].ToString());
                    gastosFunerarios += (gastosFunerarios * 0.12);

                    gastosInsolutos  = rowAIG[11].ToString().Equals("") ? 0 : Double.Parse(rowAIG[11].ToString());
                    gastosInsolutos += (gastosInsolutos * 0.12);



                    /*intereses = Double.Parse(rowAIG[6].ToString().Trim());
                     * intereses  = intereses + (intereses * 0.12 );
                     * interesesMora = Double.Parse(rowAIG[7].ToString().Trim()) +Double.Parse(rowAIG[7].ToString().Trim()) * 0.12;
                     * interesesMora0  = Double.Parse(rowAIG[8].ToString().Trim()) + Double.Parse(rowAIG[8].ToString().Trim()) * 0.12;
                     * reserva = Double.Parse(rowAIG[9].ToString().Trim()) + Double.Parse(rowAIG[9].ToString().Trim()) * 0.12;
                     * gastosFunerarios  = Double.Parse(rowAIG[10].ToString().Trim()) + Double.Parse(rowAIG[10].ToString().Trim()) * 0.12;
                     * gastosInsolutos = Double.Parse(rowAIG[11].ToString().Trim()) + Double.Parse(rowAIG[11].ToString().Trim()) * 0.12;
                     *
                     */
                    total = admin + intereses + interesesMora + interesesMora0 + reserva + gastosFunerarios + gastosInsolutos;

                    if (total == 0)
                    {
                        venta.NombreArticulo = "COMISION";
                        venta.ValorUnitario  = 0.00;
                        venta.Estado         = "A";
                        if (rowAIG[4].ToString().Equals(""))
                        {
                            venta.ClienteNombre = "ANULADO";
                        }
                        addFila(venta);
                    }
                    else
                    {
                        venta.Estado = "E";

                        if (admin > 0)
                        {
                            venta.NombreArticulo = "COMISION";
                            venta.ValorUnitario  = Math.Round(admin, 2);
                            addFila(venta);
                        }
                        if (intereses > 0)
                        {
                            venta.NombreArticulo = "INTERESES";
                            venta.ValorUnitario  = Math.Round(intereses, 2);
                            addFila(venta);
                        }
                        if (interesesMora > 0)
                        {
                            venta.NombreArticulo = "INTERESES MORATORIOS";
                            venta.ValorUnitario  = Math.Round(interesesMora, 2);
                            addFila(venta);
                        }
                        if (interesesMora0 > 0)
                        {
                            venta.NombreArticulo = "CUOTA ADMINISTRATIVA";
                            venta.ValorUnitario  = Math.Round(interesesMora0, 2);
                            addFila(venta);
                        }
                        if (reserva > 0)
                        {
                            venta.NombreArticulo = "COMISION POR OTORGAMIENTO";
                            venta.ValorUnitario  = Math.Round(reserva, 2);
                            addFila(venta);
                        }
                        if (gastosFunerarios > 0)
                        {
                            venta.NombreArticulo = "GASTOS FUNERALES";
                            venta.ValorUnitario  = Math.Round(gastosFunerarios, 2);
                            addFila(venta);
                        }
                        if (gastosInsolutos > 0)
                        {
                            venta.NombreArticulo = "SEGURO DE SALDOS INSOLUTOS";
                            venta.ValorUnitario  = Math.Round(gastosInsolutos, 2);
                            addFila(venta);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }