Пример #1
0
 public frmCP_Aprobacion_Ing_varios_Mant()
 {
     InitializeComponent();
     event_delegate_frmCP_Aprobacion_Ing_varios_Mant_FormClosed += frmCP_Aprobacion_Ing_varios_Mant_event_delegate_frmCP_Aprobacion_Ing_varios_Mant_FormClosed;
     Log_Error_bus      = new tb_sis_Log_Error_Vzen_Bus();
     param              = cl_parametrosGenerales_Bus.Instance;
     blst_det           = new BindingList <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
     info_aprobacion    = new cp_Aprobacion_Ing_Bod_x_OC_Info();
     LstTipDoc          = new List <cp_TipoDocumento_Info>();
     lst_producto       = new List <in_Producto_Info>();
     bus_producto       = new in_producto_Bus();
     lst_impuesto       = new List <tb_sis_impuesto_Info>();
     bus_impuesto       = new tb_sis_impuesto_Bus();
     info_in_param      = new in_Parametro_Info();
     bus_in_param       = new in_Parametro_Bus();
     bus_aprobacion_det = new cp_Aprobacion_Ing_Bod_x_OC_det_Bus();
     bus_aprobacion     = new cp_Aprobacion_Ing_Bod_x_OC_Bus();
     info_cp_param      = new cp_parametros_Info();
     bus_cp_param       = new cp_parametros_Bus();
     lst_unidad_medida  = new List <in_UnidadMedida_Info>();
     bus_unidad_medida  = new in_UnidadMedida_Bus();
 }
Пример #2
0
        public static void FileUploadComplete(object sender, DevExpress.Web.FileUploadCompleteEventArgs e)
        {
            #region Variables
            string ruc_proveedor = "";
            List <cp_nota_DebCre_Info> Lista_NotaDebito = new List <cp_nota_DebCre_Info>();
            cp_nota_DebCre_List        ListaNotaDebito  = new cp_nota_DebCre_List();
            int     cont                 = 0;
            int     IdCbteCble_Nota      = 1;
            decimal IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual);
            int     IdEmpresa            = Convert.ToInt32(SessionFixed.IdEmpresa);

            cp_proveedor_Bus  bus_proveedor     = new cp_proveedor_Bus();
            tb_sucursal_Bus   bus_sucursal      = new tb_sucursal_Bus();
            cp_parametros_Bus bus_cp_parametros = new cp_parametros_Bus();
            #endregion

            Stream stream = new MemoryStream(e.UploadedFile.FileBytes);
            if (stream.Length > 0)
            {
                IExcelDataReader reader = null;
                reader = ExcelReaderFactory.CreateOpenXmlReader(stream);

                #region NotaDebito
                var info_cp_parametro = bus_cp_parametros.get_info(IdEmpresa);

                while (reader.Read())
                {
                    if (!reader.IsDBNull(0) && cont > 0)
                    {
                        ruc_proveedor = Convert.ToString(reader.GetValue(1)).Trim();
                        var info_proveedor           = bus_proveedor.get_info_x_num_cedula(IdEmpresa, ruc_proveedor);
                        var lst_sucursal             = bus_sucursal.get_list(IdEmpresa, false);
                        var Su_CodigoEstablecimiento = Convert.ToString(reader.GetValue(0)).Trim();
                        var IdSucursal = Convert.ToInt32(reader.GetValue(0));

                        if (info_proveedor != null && info_proveedor.IdProveedor != 0)
                        {
                            cp_nota_DebCre_Info info = new cp_nota_DebCre_Info
                            {
                                IdEmpresa       = IdEmpresa,
                                IdCbteCble_Nota = IdCbteCble_Nota++,
                                IdTipoCbte_Nota = Convert.ToInt32(info_cp_parametro.pa_TipoCbte_ND),
                                DebCre          = "D",
                                IdTipoNota      = "T_TIP_NOTA_INT",
                                IdProveedor     = info_proveedor.IdProveedor,
                                //IdSucursal = lst_sucursal.Where(q => q.Su_CodigoEstablecimiento == Su_CodigoEstablecimiento).FirstOrDefault().IdSucursal,
                                IdSucursal         = IdSucursal,
                                cn_fecha           = Convert.ToDateTime(reader.GetValue(5)),
                                Fecha_contable     = Convert.ToDateTime(reader.GetValue(5)),
                                cn_Fecha_vcto      = Convert.ToDateTime(reader.GetValue(6)),
                                cn_observacion     = Convert.ToString(reader.GetValue(7)),
                                cn_subtotal_iva    = 0,
                                cn_subtotal_siniva = Convert.ToDouble(reader.GetValue(4)),
                                cn_baseImponible   = 0,
                                cn_Por_iva         = 12,
                                cn_valoriva        = 0,
                                cn_Ice_base        = 0,
                                cn_Ice_por         = 0,
                                cn_Ice_valor       = 0,
                                cn_Serv_por        = 0,
                                cn_Serv_valor      = 0,
                                cn_BaseSeguro      = 0,
                                cn_total           = Convert.ToDecimal(reader.GetValue(4)),
                                cn_vaCoa           = "N",
                                cod_nota           = Convert.ToString(reader.GetValue(2)),
                                IdUsuario          = SessionFixed.IdUsuario,
                                Fecha_Transac      = DateTime.Now,
                                Nombre_proveedor   = info_proveedor.info_persona.pe_razonSocial
                            };

                            Lista_NotaDebito.Add(info);
                        }
                        else
                        {
                            cp_nota_DebCre_Info info = new cp_nota_DebCre_Info
                            {
                                IdEmpresa          = IdEmpresa,
                                IdCbteCble_Nota    = IdCbteCble_Nota++,
                                IdTipoCbte_Nota    = Convert.ToInt32(info_cp_parametro.pa_TipoCbte_ND),
                                DebCre             = "D",
                                IdTipoNota         = "T_TIP_NOTA_INT",
                                cn_fecha           = Convert.ToDateTime(reader.GetValue(5)),
                                Fecha_contable     = Convert.ToDateTime(reader.GetValue(5)),
                                cn_Fecha_vcto      = Convert.ToDateTime(reader.GetValue(6)),
                                cn_observacion     = Convert.ToString(reader.GetValue(7)),
                                cn_subtotal_iva    = 0,
                                cn_subtotal_siniva = Convert.ToDouble(reader.GetValue(4)),
                                cn_baseImponible   = 0,
                                cn_Por_iva         = 12,
                                cn_valoriva        = 0,
                                cn_Ice_base        = 0,
                                cn_Ice_por         = 0,
                                cn_Ice_valor       = 0,
                                cn_Serv_por        = 0,
                                cn_Serv_valor      = 0,
                                cn_BaseSeguro      = 0,
                                cn_total           = Convert.ToDecimal(reader.GetValue(4)),
                                cn_vaCoa           = "N",
                                cod_nota           = Convert.ToString(reader.GetValue(2)),
                                IdUsuario          = SessionFixed.IdUsuario,
                                Fecha_Transac      = DateTime.Now,
                                Nombre_proveedor   = ruc_proveedor
                            };
                            Lista_NotaDebito.Add(info);
                        }
                    }
                    else
                    {
                        cont++;
                    }
                }
                ListaNotaDebito.set_list(Lista_NotaDebito, IdTransaccionSession);
                #endregion
            }
        }
Пример #3
0
        public void GeneraDiarioRetencion()
        {
            try
            {
                UC_CbteCble_Retencion.validaValores = false;
                UC_CbteCble_Retencion.setDetalle(new List <ct_Cbtecble_det_Info>());
                ListDiarioRet = new List <ct_Cbtecble_det_Info>();
                double Sum_Ret_valor = 0;

                // RETENCION

                foreach (var item in BindingList_codigoSRI)
                {
                    if (item.co_porRetencion > 0)
                    {
                        double valor = 0;

                        if (item.MontoRetencion > 0)
                        {
                            valor = Math.Round(item.MontoRetencion, 2);
                        }
                        else
                        {
                            if (item.BaseImponible != 0)
                            {
                                if (item.Tipo == "IVA")
                                {
                                    item.MontoRetencion = item.BaseImponible * (item.co_porRetencion / 100);
                                    valor = item.MontoRetencion;
                                }
                                else
                                {
                                    item.MontoRetencion = item.BaseImponible * (item.co_porRetencion / 100);
                                    valor = item.MontoRetencion;
                                }
                            }
                        }

                        ct_Cbtecble_det_Info regDebe = new ct_Cbtecble_det_Info();

                        string IdCtaCble_iva = "";
                        string IdCtaCble_ret = "";

                        if (String.IsNullOrEmpty(item.IdCtaCble))
                        {
                            // obtener ctacble retencion de parametros
                            cp_parametros_Bus  bus_param  = new cp_parametros_Bus();
                            cp_parametros_Info info_param = new cp_parametros_Info();
                            info_param = bus_param.Get_Info_parametros(param.IdEmpresa);

                            if (item.Tipo == "IVA")
                            {
                                if (String.IsNullOrEmpty(info_param.pa_ctacble_x_RetIva_default))
                                {
                                    IdCtaCble_iva = "";
                                }
                                else
                                {
                                    IdCtaCble_iva = info_param.pa_ctacble_x_RetIva_default;
                                }
                                regDebe.IdCtaCble = IdCtaCble_iva;
                            }
                            else
                            {
                                if (String.IsNullOrEmpty(info_param.pa_ctacble_x_RetFte_default))
                                {
                                    IdCtaCble_ret = "";
                                }
                                else
                                {
                                    IdCtaCble_ret = info_param.pa_ctacble_x_RetFte_default;
                                }
                                regDebe.IdCtaCble = IdCtaCble_ret;
                            }
                        }
                        else
                        {
                            regDebe.IdCtaCble = item.IdCtaCble == null ? "" : item.IdCtaCble.Trim();
                        }


                        regDebe.IdTipoCbte     = IdTipoCbte_x_Retencion;
                        regDebe.dc_Valor       = valor * -1;
                        regDebe.dc_Observacion = nomProveedor;
                        regDebe.tipo           = item.Tipo;

                        ListDiarioRet.Add(regDebe);


                        Sum_Ret_valor = Sum_Ret_valor + valor;
                    }
                }// fin foreach



                // cta por pagar 1 sola vez acumulada
                ct_Cbtecble_det_Info regHaber = new ct_Cbtecble_det_Info();
                regHaber.IdCtaCble      = IdCtaCble_CXP;
                regHaber.IdTipoCbte     = IdTipoCbte_x_Retencion;
                regHaber.dc_Valor       = Sum_Ret_valor;
                regHaber.dc_Observacion = "Ret cxp";
                regHaber.tipo           = "IVA/RET";

                ListDiarioRet.Add(regHaber);


                UC_CbteCble_Retencion.setDetalle(ListDiarioRet);
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }