public Boolean GuardarDB(fa_pre_facturacion_Parametro_Info Info, ref string mensaje)
        {
            try
            {
                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    fa_pre_facturacion_Parametro contact = new fa_pre_facturacion_Parametro();

                    contact.IdEmpresa           = Info.IdEmpresa;
                    contact.Se_Cobra_Iva        = Info.Se_Cobra_Iva;
                    contact.Tipo_Cobro_Poliza_X = Info.Tipo_Cobro_Poliza_X;
                    contact.Liquidar_x_grupo    = Info.Liquidar_x_grupo;
                    // contact.Margen_Ganancia_por_BS = Info.Margen_Ganancia_por_BS;
                    // contact.Margen_Ganancia_por_MO = Info.Margen_Ganancia_por_MO;
                    Context.fa_pre_facturacion_Parametro.Add(contact);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        public fa_pre_facturacion_Parametro_Info Get_Info_Parametro(int IdEmpresa)
        {
            try
            {
                fa_pre_facturacion_Parametro_Info Info = new fa_pre_facturacion_Parametro_Info();

                using (Entity_Facturacion_FJ Context = new Entity_Facturacion_FJ())
                {
                    fa_pre_facturacion_Parametro contact = Context.fa_pre_facturacion_Parametro.FirstOrDefault(q => q.IdEmpresa == IdEmpresa);

                    if (contact != null)
                    {
                        Info.IdEmpresa                = contact.IdEmpresa;
                        Info.Se_Cobra_Iva             = contact.Se_Cobra_Iva;
                        Info.Tipo_Cobro_Poliza_X      = contact.Tipo_Cobro_Poliza_X;
                        Info.IdSucursal_para_facturar = (contact.IdSucursal_para_facturar == null) ? 0 : Convert.ToInt32(contact.IdSucursal_para_facturar);
                        Info.IdBodega_para_facturar   = (contact.IdBodega_para_facturar == null) ? 0 : Convert.ToInt32(contact.IdBodega_para_facturar);
                        Info.Liquidar_x_grupo         = contact.Liquidar_x_grupo;
                        // Info.Margen_Ganancia_por_BS = contact.Margen_Ganancia_por_BS;
                        // Info.Margen_Ganancia_por_MO = contact.Margen_Ganancia_por_MO;
                    }
                }
                return(Info);
            }
            catch (Exception ex)
            {
                string MensajeError = "";
                string arreglo      = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError);
                MensajeError = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Example #3
0
        private void Mostrar_grillas_x_parametros()
        {
            try
            {
                param_prefacturacion = bus_prefacturacion_param.Get_Info(param.IdEmpresa);
                if (param_prefacturacion != null)
                {
                    if (param_prefacturacion.Se_Cobra_Iva)
                    {
                        colIva_egr.Visible = true;
                        colIva_gas.Visible = true;
                        colIva_mar.Visible = true;
                        colIva_pol.Visible = true;
                    }
                    else
                    {
                        colIva_egr.Visible = false;
                        colIva_gas.Visible = false;
                        colIva_mar.Visible = false;
                        colIva_pol.Visible = false;
                    }
                    switch (param_prefacturacion.Tipo_Cobro_Poliza_X)
                    {
                    case "X_ACTIVO":
                        colCostoUnitario_pol.Visible = true;
                        colSubtotal_pol.Visible      = true;
                        colActivo_pol.Visible        = true;
                        colEstadoFacturacion.Visible = false;
                        colCodigo_pol.Visible        = false;
                        break;

                    case "X_CUOTAS":
                        colCostoUnitario_pol.Visible = false;
                        colEstadoFacturacion.Visible = true;
                        colSubtotal_pol.Visible      = false;
                        colActivo_pol.Visible        = false;
                        colCodigo_pol.Visible        = true;
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
Example #4
0
 void Set_Info_Parametro()
 {
     try
     {
         Info_Param = Bus_Param.Get_Info(param.IdEmpresa);
         chk_se_cobra_iva.Checked = Info_Param.Se_Cobra_Iva;
         ucFa_Catalogos_Cmb.set_CatalogosInfo(Info_Param.Tipo_Cobro_Poliza_X);
         chk_se_liquida_x_grupos.Checked = Info_Param.Liquidar_x_grupo;
         //  txt_Margen_Ganancia_por_BS.EditValue = Info_Param.Margen_Ganancia_por_BS;
         //  txt_Margen_Ganancia_por_MO.EditValue = Info_Param.Margen_Ganancia_por_MO;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #5
0
        public Boolean ModificarDB(fa_pre_facturacion_Parametro_Info Info, ref string mensaje)
        {
            bool bandera = false;

            try
            {
                if (oData.ModificarDB(Info, ref mensaje))
                {
                    bandera = true;
                    bandera = bus_margen_ganacia.Guardar(Info.lis_param_x_fuerza);
                }
                return(bandera);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Obtener", ex.Message), ex)
                      {
                          EntityType = typeof(fa_pre_facturacion_Parametro_Bus)
                      };
            }
        }
Example #6
0
        public bool Convert_Liquidacion_a_Factura(int IdEmpresa, decimal IdLiquidacion_gastos, ref decimal IdCbteVta, ref string mensaje)
        {
            try
            {
                bool respuesta = false;
                fa_liquidacion_gastos_Bus         Bus_liqu_gastos    = new fa_liquidacion_gastos_Bus();
                fa_liquidacion_gastos_Info        InfoLiqui_Gasto    = new fa_liquidacion_gastos_Info();
                fa_pre_facturacion_Parametro_Info Info_Pre_fac_param = new fa_pre_facturacion_Parametro_Info();
                fa_pre_facturacion_Parametro_Bus  Bus_Pre_fac_param  = new fa_pre_facturacion_Parametro_Bus();

                Info_Pre_fac_param = Bus_Pre_fac_param.Get_Info(IdEmpresa);

                if (Info_Pre_fac_param.IdSucursal_para_facturar == 0 || Info_Pre_fac_param.IdBodega_para_facturar == 0)
                {
                    mensaje = "no hay IdSucursal o idbodega para factura en parametros de Liquidacion verifique y configure";
                    throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "no hay IdSucursal o idbodega para factura en parametros de Liquidacion verifique y configure ", mensaje))
                          {
                              EntityType = typeof(fa_liquidacion_gastos_Bus)
                          };
                }

                InfoLiqui_Gasto = Bus_liqu_gastos.Get_Info_Liquidacion_Gastos(IdEmpresa, IdLiquidacion_gastos, ref mensaje);

                if (InfoLiqui_Gasto.Lis_Detalle.Count() == 0)
                {
                    mensaje = "Liquidacion no tiene detalle";
                    return(false);
                }

                fa_factura_Bus  Bus_factura  = new fa_factura_Bus();
                fa_factura_Info Info_Factura = new fa_factura_Info();



                Info_Factura.IdEmpresa      = InfoLiqui_Gasto.IdEmpresa;
                Info_Factura.IdSucursal     = Info_Pre_fac_param.IdSucursal_para_facturar;
                Info_Factura.IdBodega       = Info_Pre_fac_param.IdBodega_para_facturar;
                Info_Factura.vt_tipoDoc     = "FACT";
                Info_Factura.IdCliente      = InfoLiqui_Gasto.IdCliente;
                Info_Factura.IdVendedor     = 1;
                Info_Factura.vt_fecha       = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                Info_Factura.vt_fech_venc   = Info_Factura.vt_fecha;
                Info_Factura.vt_plazo       = 0;
                Info_Factura.vt_tipo_venta  = "CON";
                Info_Factura.vt_Observacion = "Fact x Liqui : " + InfoLiqui_Gasto.Observacion;
                Info_Factura.IdPeriodo      = ((Info_Factura.vt_fecha.Year) * 100) + Info_Factura.vt_fecha.Month;
                Info_Factura.vt_anio        = Info_Factura.vt_fecha.Year;
                Info_Factura.vt_mes         = Info_Factura.vt_fecha.Month;
                Info_Factura.Estado         = "A";
                Info_Factura.IdCaja         = 1;


                List <fa_factura_det_info> list_det_factura = new List <fa_factura_det_info>();


                foreach (fa_liquidacion_gastos_det_Info item_det in InfoLiqui_Gasto.Lis_Detalle)
                {
                    fa_factura_det_info Info_det_factura = new fa_factura_det_info();

                    Info_det_factura.IdEmpresa          = Info_Factura.IdEmpresa;
                    Info_det_factura.IdSucursal         = Info_Factura.IdSucursal;
                    Info_det_factura.IdBodega           = Info_Factura.IdBodega;
                    Info_det_factura.IdCbteVta          = 0;
                    Info_det_factura.Secuencia          = item_det.secuencia;
                    Info_det_factura.IdProducto         = item_det.IdProducto;
                    Info_det_factura.vt_cantidad        = item_det.cantidad;
                    Info_det_factura.vt_Precio          = item_det.precio;
                    Info_det_factura.vt_PrecioFinal     = item_det.precio;
                    Info_det_factura.vt_Subtotal        = item_det.subtotal;
                    Info_det_factura.vt_iva             = item_det.valor_iva;
                    Info_det_factura.vt_por_iva         = item_det.por_iva;
                    Info_det_factura.vt_total           = item_det.Total_liq;
                    Info_det_factura.vt_estado          = "A";
                    Info_det_factura.IdCod_Impuesto_Iva = param.iva.IdCod_Impuesto;
                    Info_det_factura.vt_detallexItems   = item_det.detalle_x_producto;
                    Info_det_factura.IdPunto_cargo      = null;
                    list_det_factura.Add(Info_det_factura);
                }

                Info_Factura.DetFactura_List = list_det_factura;

                string num_doc_x_fac = "";
                string mensaje_dupli = "";

                respuesta = Bus_factura.GuardarDB(Info_Factura, ref IdCbteVta, ref num_doc_x_fac, ref mensaje, ref mensaje_dupli);

                return(respuesta);
            }
            catch (Exception ex)
            {
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", "", "", "", "", "", "", DateTime.Now);
                throw new Exception();
            }
        }