Exemplo n.º 1
0
 private void UCIn_Parametro_Load(object sender, EventArgs e)
 {
     try
     {
         cargar_planCuenta_combos();
         cargar_TipoCbteCble_combos();
         cargar_centroCosto_combos();
         cargar_TipoMovi_Inven_combos();
         cargar_centroCosto_padre_combos();
         info = bus.Get_Info_Parametro(param.IdEmpresa);
         cmbStockNeg.SelectedItem                        = (info.Maneja_Stock_Negativo == "S") ? "Si" : "No";
         cmb_ctacble_Inven.EditValue                     = info.IdCtaCble_Inven;
         cmb_ctacble_costo_inven.EditValue               = info.IdCtaCble_CostoInven;
         cmb_centro_costo_inven.EditValue                = info.IdCentro_Costo_Inventario;
         cmb_centro_costo_cta_centro_costo.EditValue     = info.IdCentro_Costo_Costo;
         cmbTipoCbteCble_Trans_costo_Inven.EditValue     = info.IdTipoCbte_CostoInven;
         cmbTipoCbteCble_Trans_Anu_costo_Inven.EditValue = info.IdTipoCbte_CostoInven_Reverso;
         cmb_tipo_movi_inven_anu_egr.EditValue           = info.IdMovi_Inven_tipo_x_anu_Egr;
         cmb_tipo_movi_inven_anu_ing.EditValue           = info.IdMovi_Inven_tipo_x_anu_Ing;
         cmb_tipo_movi_inven_x_transf_ing.EditValue      = info.IdMovi_inven_tipo_ingresoBodegaDestino;
         cmb_tipo_movi_inven_x_transf_egr.EditValue      = info.IdMovi_inven_tipo_egresoBodegaOrigen;
         cmbUsuatioEscogeMot.SelectedItem                = (info.Usuario_Escoge_Motivo == "S") ? "Si" : "No";
         cmb_tipo_movi_inven_egr_x_ajus_fisico.EditValue = info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa;
         cmb_tipo_movi_inven_ing_x_ajus_fisico.EditValue = info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa;
         ckAjust.Checked = (info.ApruebaAjusteFisicoAuto == "S" ? true : false);
         cmb_tipo_movi_inven_ing_x_ajus.EditValue = info.IdMovi_inven_tipo_ingresoAjuste;
         cmb_tipo_movi_inven_egr_x_ajus.EditValue = info.IdMovi_inven_tipo_egresoAjuste;
     }
     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());
     }
 }
Exemplo n.º 2
0
 public FrmIn_TransferenciaConGuiaMantenimiento()
 {
     InitializeComponent();
     param             = cl_parametrosGenerales_Bus.Instance;
     busLogError       = new tb_sis_Log_Error_Vzen_Bus();
     busTransferencia  = new in_transferencia_bus();
     busProducto       = new in_producto_Bus();
     busSucursal       = new tb_Sucursal_Bus();
     busBodega         = new tb_Bodega_Bus();
     busUnidadMedida   = new in_UnidadMedida_Bus();
     lstBodega         = new List <tb_Bodega_Info>();
     lstSucursal       = new List <tb_Sucursal_Info>();
     blstDetalle       = new BindingList <in_transferencia_det_Info>();
     infoTransferencia = new in_transferencia_Info();
     busDet            = new in_Transferencia_det_Bus();
     event_delegate_FrmIn_TransferenciaConGuiaMantenimiento_FormClosed += FrmIn_TransferenciaConGuiaMantenimiento_event_delegate_FrmIn_TransferenciaConGuiaMantenimiento_FormClosed;
     busParam         = new in_Parametro_Bus();
     infoParam        = new in_Parametro_Info();
     lstProducto      = new List <in_Producto_Info>();
     busIngEgr        = new in_Ing_Egr_Inven_Bus();
     busPedido        = new com_OrdenPedido_Bus();
     lstOCDet         = new List <in_transferencia_det_Info>();
     busTransportista = new tb_transportista_Bus();
     lstTransportista = new List <tb_transportista_Info>();
     busCatalogo      = new in_Catalogo_Bus();
     busGuia          = new in_Guia_x_traspaso_bodega_Bus();
 }
Exemplo n.º 3
0
        private void CargarCombos()
        {
            try
            {
                cmbSucursalOrigen.Properties.ReadOnly = true;
                btnConsultarIngreso.Visible           = true;
                btnConsultarEgreso.Visible            = true;
                deFecha.EditValue = DateTime.Now.Date;
                lstSucursal       = busSucursal.Get_List_Sucursal(param.IdEmpresa);
                lstBodega         = busBodega.Get_List_Bodega(param.IdEmpresa, Cl_Enumeradores.eTipoFiltro.Normal);
                if (Accion == Cl_Enumeradores.eTipo_action.grabar || Accion == Cl_Enumeradores.eTipo_action.actualizar)
                {
                    cmbProducto.DataSource = lstProducto = busProducto.GetListProductoCombo(param.IdEmpresa, Cl_Enumeradores.eModulos.INV);
                }

                cmbUnidadMedida.DataSource = busUnidadMedida.Get_list_UnidadMedida();

                cmbSucursalOrigen.Properties.DataSource  = lstSucursal;
                cmbSucursalDestino.Properties.DataSource = lstSucursal;
                cmbSucursalOC.Properties.DataSource      = lstSucursal;

                cmbSucursalOrigen.EditValue = param.IdSucursal;
                cmbSucursalOC.EditValue     = param.IdSucursal;
                infoParam        = busParam.Get_Info_Parametro(param.IdEmpresa);
                lstTransportista = busTransportista.Get_List_transportista(param.IdEmpresa);
                cmbTransportista.Properties.DataSource = lstTransportista;

                cmbMotivo.Properties.DataSource = busCatalogo.Get_List_Catalogo(3);
            }
            catch (Exception ex)
            {
                busLogError.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        private void CargarCombos()
        {
            try
            {
                btnConsultarIngreso.Visible = true;
                btnConsultarEgreso.Visible  = true;
                deFecha.EditValue           = DateTime.Now.Date;
                lstSucursal = busSucursal.Get_List_Sucursal(param.IdEmpresa);
                lstBodega   = busBodega.Get_List_Bodega(param.IdEmpresa, Cl_Enumeradores.eTipoFiltro.Normal);

                cmbSucursalOrigen.Properties.DataSource  = lstSucursal;
                cmbSucursalDestino.Properties.DataSource = lstSucursal;

                cmbSucursalOrigen.EditValue = param.IdSucursal;
                infoParam        = busParam.Get_Info_Parametro(param.IdEmpresa);
                lstTransportista = busTransportista.Get_List_transportista(param.IdEmpresa);
                cmbTransportista.Properties.DataSource = lstTransportista;

                cmbMotivo.Properties.DataSource = busCatalogo.Get_List_Catalogo(3);
            }
            catch (Exception ex)
            {
                busLogError.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
        private void frminv_parametro_Load(object sender, EventArgs e)
        {
            try
            {
                Cargar_combos();

                info = bus.Get_Info_Parametro(param.IdEmpresa);
                if (info != null)
                {
                    cmbStockNeg.SelectedItem = (info.Maneja_Stock_Negativo == "S") ? "Si" : "No";
                    cmb_ctacble_Inven.set_PlanCtarInfo(info.IdCtaCble_Inven);
                    cmb_ctacble_costo_inven.set_PlanCtarInfo(info.IdCtaCble_CostoInven);

                    cmbTipoCbteCble_Trans_costo_Inven.set_TipoCbteCble(Convert.ToInt32(info.IdTipoCbte_CostoInven));
                    cmbTipoCbteCble_Trans_Anu_costo_Inven.set_TipoCbteCble(Convert.ToInt32(info.IdTipoCbte_CostoInven_Reverso));
                    cmb_tipo_movi_inven_anu_egr.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_anu_Egr));
                    cmb_tipo_movi_inven_anu_ing.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_anu_Ing));
                    cmb_tipo_movi_inven_x_transf_ing.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_ingresoBodegaDestino));
                    cmb_tipo_movi_inven_x_transf_egr.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_egresoBodegaOrigen));
                    cmbUsuatioEscogeMot.SelectedItem = (info.Usuario_Escoge_Motivo == "S") ? "Si" : "No";
                    cmb_tipo_movi_inven_egr_x_ajus_fisico.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa));
                    cmb_tipo_movi_inven_ing_x_ajus_fisico.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa));
                    ckAjust.Checked = (info.ApruebaAjusteFisicoAuto == "S" ? true : false);
                    cmb_tipo_movi_inven_ing_x_ajus.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_ingresoAjuste));
                    cmb_tipo_movi_inven_egr_x_ajus.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_egresoAjuste));
                    cmbEstadoAproba_Ingr.EditValue = info.IdEstadoAproba_x_Ing;
                    cmbEstadoAproba_Egre.EditValue = info.IdEstadoAproba_x_Egr;
                    cmb_catalogo_Fecha_conta.set_CatalogosInfo(info.P_Fecha_para_contabilizacion_ingr_egr);
                    chk_para_conta_oblig_produ_ten_ctaInv.Checked = info.P_se_valida_parametrizacion_x_producto == null ? false : (bool)info.P_se_valida_parametrizacion_x_producto;
                    cmb_PlanCta.set_PlanCtarInfo(info.P_IdCtaCble_transitoria_transf_inven);

                    cmb_dev_inven_x_ing.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing));
                    cmb_dev_inven_x_egr.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg));
                    chk_crear_lote_0_automatico.Checked = info.P_se_crea_lote_0_al_crear_producto_matriz == null ? false : Convert.ToBoolean(info.P_se_crea_lote_0_al_crear_producto_matriz);
                    cmb_tipo_producto_lote.set_TipoProductoInfo(info.P_IdProductoTipo_para_lote_0 == null ? 0 : Convert.ToInt32(info.P_IdProductoTipo_para_lote_0));

                    cmb_tipo_movi_distribucion_egr.set_TipoMoviInvInfo(info.IdMovi_inven_tipo_x_distribucion_egr == null ? 0 : Convert.ToInt32(info.IdMovi_inven_tipo_x_distribucion_egr));
                    cmb_tipo_movi_distribucion_ing.set_TipoMoviInvInfo(info.IdMovi_inven_tipo_x_distribucion_ing == null ? 0 : Convert.ToInt32(info.IdMovi_inven_tipo_x_distribucion_ing));

                    cmb_tipo_movi_default_egr.set_TipoMoviInvInfo(info.P_IdMovi_inven_tipo_default_egr == null ? 0 : Convert.ToInt32(info.P_IdMovi_inven_tipo_default_egr));
                    cmb_tipo_movi_default_ing.set_TipoMoviInvInfo(info.P_IdMovi_inven_tipo_default_ing == null ? 0 : Convert.ToInt32(info.P_IdMovi_inven_tipo_default_ing));
                    cmb_tipo_movi_ing_x_compras.set_TipoMoviInvInfo(info.P_IdMovi_inven_tipo_ingreso_x_compra == null ? 0 : Convert.ToInt32(info.P_IdMovi_inven_tipo_ingreso_x_compra));
                    spinEdit_dias_amarillo.EditValue = info.P_Dias_menores_alerta_desde_fecha_actual_amarillo == null ? 0 : Convert.ToInt32(info.P_Dias_menores_alerta_desde_fecha_actual_amarillo);
                    spinEdit_dias_rojo.EditValue     = info.P_Dias_menores_alerta_desde_fecha_actual_rojo == null ? 0 : Convert.ToInt32(info.P_Dias_menores_alerta_desde_fecha_actual_rojo);
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 6
0
        public void getParametrosInventario()
        {
            try
            {
                if (info == null)
                {
                    info = new in_Parametro_Info();
                }

                info.Maneja_Stock_Negativo = (cmbStockNeg.SelectedItem == "Si") ? "S" : "N";
                info.Usuario_Escoge_Motivo = (cmbUsuatioEscogeMot.SelectedItem == "Si") ? "S" : "N";
                info.Mostrar_CentroCosto_en_transacciones = (cmbCCostoTran.SelectedItem == "Si") ? "S" : "N";
                info.LabelCentroCosto              = "";
                info.IdTipoCbte_CostoInven         = cmbTipoCbteCble_Trans_costo_Inven.get_TipoCbteCble().IdTipoCbte;
                info.IdTipoCbte_CostoInven_Reverso = cmbTipoCbteCble_Trans_Anu_costo_Inven.get_TipoCbteCble().IdTipoCbte;
                info.IdCtaCble_Inven      = cmb_ctacble_Inven.get_PlanCtaInfo().IdCtaCble;
                info.IdCtaCble_CostoInven = cmb_ctacble_costo_inven.get_PlanCtaInfo().IdCtaCble;


                info.IdMovi_Inven_tipo_x_anu_Ing            = cmb_tipo_movi_inven_anu_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_x_anu_Egr            = cmb_tipo_movi_inven_anu_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdSucursalSuministro                   = ucIn_Sucursal_Bodega1.get_bodega().IdSucursal;
                info.IdBodegaSuministro                     = ucIn_Sucursal_Bodega1.get_bodega().IdBodega;
                info.IdMovi_inven_tipo_ingresoBodegaDestino = cmb_tipo_movi_inven_x_transf_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_inven_tipo_egresoBodegaOrigen   = cmb_tipo_movi_inven_x_transf_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = cmb_tipo_movi_inven_egr_x_ajus_fisico.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = cmb_tipo_movi_inven_ing_x_ajus_fisico.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.ApruebaAjusteFisicoAuto                = (ckAjust.Checked == true ? "S" : "N");
                info.IdMovi_inven_tipo_ingresoAjuste        = cmb_tipo_movi_inven_ing_x_ajus.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_inven_tipo_egresoAjuste         = cmb_tipo_movi_inven_egr_x_ajus.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdEstadoAproba_x_Ing                   = Convert.ToString(cmbEstadoAproba_Ingr.EditValue);
                info.IdEstadoAproba_x_Egr                   = Convert.ToString(cmbEstadoAproba_Egre.EditValue);
                info.P_Grabar_Items_x_Cada_Movi_Inven       = chk_Registrar_ingreso_x_item.Checked == true ? true : false;
                info.P_Fecha_para_contabilizacion_ingr_egr  = cmb_catalogo_Fecha_conta.Get_CatalogosInfo().IdCatalogo;
                info.P_se_valida_parametrizacion_x_producto = chk_para_conta_oblig_produ_ten_ctaInv.Checked;

                info.P_IdCtaCble_transitoria_transf_inven = cmb_PlanCta.get_PlanCtaInfo().IdCtaCble;
                //info.P_Al_Conta_CtaCosto_Buscar_en =(ein_TipoContabilizacion_Cta_Inven_Costo) Enum.Parse(typeof(ein_TipoContabilizacion_Cta_Inven_Costo), cmb_al_conta_cta_costo_buscar_en.Get_CatalogosInfo().IdCatalogo);
                //info.P_Al_Conta_CtaInven_Buscar_en = (ein_TipoContabilizacion_Cta_Inven_Costo)Enum.Parse(typeof(ein_TipoContabilizacion_Cta_Inven_Costo), cmb_al_conta_cta_inv_buscar_en.Get_CatalogosInfo().IdCatalogo);


                info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing = cmb_dev_inven_x_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg = cmb_dev_inven_x_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 7
0
 public FrmIn_producto_asignacion_lote()
 {
     InitializeComponent();
     Log_Error_bus       = new tb_sis_Log_Error_Vzen_Bus();
     param               = cl_parametrosGenerales_Bus.Instance;
     lst_producto        = new List <in_Producto_Info>();
     bus_producto        = new in_producto_Bus();
     info_producto_padre = new in_Producto_Info();
     blst          = new BindingList <in_producto_lote>();
     lst_retorno   = new List <in_producto_lote>();
     Result        = System.Windows.Forms.DialogResult.Cancel;
     info_in_param = new in_Parametro_Info();
     bus_in_param  = new in_Parametro_Bus();
     info_retorno  = new in_producto_lote();
 }
Exemplo n.º 8
0
 public Boolean ModificarDB(in_Parametro_Info inf, int IdEmpresa)
 {
     try
     {
         return(oData.ModificarDB(inf, IdEmpresa));
     }
     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("", "Modificar", ex.Message), ex)
               {
                   EntityType = typeof(in_Parametro_Bus)
               };
     }
 }
Exemplo n.º 9
0
 public Boolean ModificarDB(in_Parametro_Info info, int IdEmpresa)
 {
     try
     {
         using (SqlConnection connection = new SqlConnection(ConexionERP.GetConnectionString()))
         {
             connection.Open();
             SqlCommand command = new SqlCommand();
             command.Connection  = connection;
             command.CommandText = "UPDATE [dbo].[in_parametro]"
                                   + " SET [IdMovi_inven_tipo_egresoBodegaOrigen] = " + (info.IdMovi_inven_tipo_egresoBodegaOrigen == null ? "NULL" : info.IdMovi_inven_tipo_egresoBodegaOrigen.ToString())
                                   + " ,[IdMovi_inven_tipo_ingresoBodegaDestino] = " + (info.IdMovi_inven_tipo_ingresoBodegaDestino == null ? "NULL" : info.IdMovi_inven_tipo_ingresoBodegaDestino.ToString())
                                   + " ,[Maneja_Stock_Negativo] " + (info.Maneja_Stock_Negativo == null ? "NULL" : ("'" + info.Maneja_Stock_Negativo.ToString() + "'"))
                                   + " ,[IdMovi_inven_tipo_egresoAjuste] = " + (info.IdMovi_inven_tipo_egresoAjuste == null ? "NULL" : info.IdMovi_inven_tipo_egresoAjuste.ToString())
                                   + " ,[IdMovi_inven_tipo_ingresoAjuste] = " + (info.IdMovi_inven_tipo_ingresoAjuste == null ? "NULL" : info.IdMovi_inven_tipo_ingresoAjuste.ToString())
                                   + " ,[IdTipoCbte_CostoInven] = " + (info.IdTipoCbte_CostoInven == null ? "NULL" : info.IdTipoCbte_CostoInven.ToString())
                                   + " ,[IdMovi_Inven_tipo_x_anu_Ing] = " + (info.IdMovi_Inven_tipo_x_anu_Ing == null ? "NULL" : info.IdMovi_Inven_tipo_x_anu_Ing.ToString())
                                   + " ,[IdMovi_Inven_tipo_x_anu_Egr] = " + (info.IdMovi_Inven_tipo_x_anu_Egr == null ? "NULL" : info.IdMovi_Inven_tipo_x_anu_Egr.ToString())
                                   + " ,[IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa] = " + (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa == null ? "NULL" : info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa.ToString())
                                   + " ,[IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa] = " + (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa == null ? "NULL" : info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa.ToString())
                                   + " ,[ApruebaAjusteFisicoAuto] = " + (info.ApruebaAjusteFisicoAuto == null ? "NULL" : ("'" + info.ApruebaAjusteFisicoAuto.ToString() + "'"))
                                   + " ,[IdEstadoAproba_x_Ing] = " + (info.IdEstadoAproba_x_Ing == null ? "NULL" : ("'" + info.IdEstadoAproba_x_Ing.ToString() + "'"))
                                   + " ,[IdEstadoAproba_x_Egr] = " + (info.IdEstadoAproba_x_Egr == null ? "NULL" : ("'" + info.IdEstadoAproba_x_Egr.ToString() + "'"))
                                   + " ,[IdMovi_Inven_tipo_x_Dev_Inv_x_Ing] = " + (info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing == null ? "NULL" : info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing.ToString())
                                   + " ,[IdMovi_Inven_tipo_x_Dev_Inv_x_Erg] = " + (info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg == null ? "NULL" : info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg.ToString())
                                   + " ,[P_Grabar_Items_x_Cada_Movi_Inven] = " + (info.P_Grabar_Items_x_Cada_Movi_Inven == null ? "NULL" : ((bool)info.P_Grabar_Items_x_Cada_Movi_Inven ? "1" : "0"))
                                   + " ,[P_Fecha_para_contabilizacion_ingr_egr] = " + (info.P_Fecha_para_contabilizacion_ingr_egr == null ? "NULL" : info.P_Fecha_para_contabilizacion_ingr_egr.ToString())
                                   + " ,[P_se_valida_parametrizacion_x_producto] = " + (info.P_se_valida_parametrizacion_x_producto == null ? "NULL" : info.P_se_valida_parametrizacion_x_producto.ToString())
                                   + " ,[P_IdCtaCble_transitoria_transf_inven] = " + (info.P_IdCtaCble_transitoria_transf_inven == null ? "NULL" : ("'" + info.P_IdCtaCble_transitoria_transf_inven.ToString() + "'"))
                                   + " ,[IdMovi_inven_tipo_mobile_ing] = " + (info.IdMovi_inven_tipo_mobile_ing == null ? "NULL" : info.IdMovi_inven_tipo_mobile_ing.ToString())
                                   + " ,[IdMovi_inven_tipo_mobile_egr] = " + (info.IdMovi_inven_tipo_mobile_egr == null ? "NULL" : info.IdMovi_inven_tipo_mobile_egr.ToString())
                                   + " ,[P_ValidarDiasHaciaAtras] = " + (info.P_ValidarDiasHaciaAtras == null ? "NULL" : info.P_ValidarDiasHaciaAtras.ToString())
                                   + " ,[IdCtaCble_Provision] = " + (info.IdCtaCble_Provision == null ? "NULL" : ("'" + info.IdCtaCble_Provision.ToString() + "'"))
                                   + " WHERE IdEmpresa = " + IdEmpresa.ToString();
             command.ExecuteNonQuery();
             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() + " " + ex.Message;
         throw new Exception(mensaje);
     }
 }
Exemplo n.º 10
0
        private void frminv_parametro_Load(object sender, EventArgs e)
        {
            try
            {
                Cargar_combos();

                info = bus.Get_Info_Parametro(param.IdEmpresa);
                if (info != null)
                {
                    cmbStockNeg.SelectedItem = (info.Maneja_Stock_Negativo == "S") ? "Si" : "No";
                    cmb_ctacble_Inven.set_PlanCtarInfo(info.IdCtaCble_Inven);
                    cmb_ctacble_costo_inven.set_PlanCtarInfo(info.IdCtaCble_CostoInven);

                    cmbTipoCbteCble_Trans_costo_Inven.set_TipoCbteCble(Convert.ToInt32(info.IdTipoCbte_CostoInven));
                    cmbTipoCbteCble_Trans_Anu_costo_Inven.set_TipoCbteCble(Convert.ToInt32(info.IdTipoCbte_CostoInven_Reverso));
                    cmbCCostoTran.SelectedItem = (info.Mostrar_CentroCosto_en_transacciones == "S") ? "Si" : "No";
                    cmb_tipo_movi_inven_anu_egr.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_anu_Egr));
                    cmb_tipo_movi_inven_anu_ing.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_anu_Ing));
                    ucIn_Sucursal_Bodega1.set_Idbodega(info.IdSucursalSuministro, info.IdBodegaSuministro);
                    cmb_tipo_movi_inven_x_transf_ing.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_ingresoBodegaDestino));
                    cmb_tipo_movi_inven_x_transf_egr.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_egresoBodegaOrigen));
                    cmbUsuatioEscogeMot.SelectedItem = (info.Usuario_Escoge_Motivo == "S") ? "Si" : "No";
                    cmb_tipo_movi_inven_egr_x_ajus_fisico.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa));
                    cmb_tipo_movi_inven_ing_x_ajus_fisico.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa));
                    ckAjust.Checked = (info.ApruebaAjusteFisicoAuto == "S" ? true : false);
                    cmb_tipo_movi_inven_ing_x_ajus.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_ingresoAjuste));
                    cmb_tipo_movi_inven_egr_x_ajus.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_inven_tipo_egresoAjuste));
                    cmbEstadoAproba_Ingr.EditValue       = info.IdEstadoAproba_x_Ing;
                    cmbEstadoAproba_Egre.EditValue       = info.IdEstadoAproba_x_Egr;
                    chk_Registrar_ingreso_x_item.Checked = info.P_Grabar_Items_x_Cada_Movi_Inven == null ? false : (bool)info.P_Grabar_Items_x_Cada_Movi_Inven;
                    cmb_catalogo_Fecha_conta.set_CatalogosInfo(info.P_Fecha_para_contabilizacion_ingr_egr);
                    chk_para_conta_oblig_produ_ten_ctaInv.Checked = info.P_se_valida_parametrizacion_x_producto == null ? false : (bool)info.P_se_valida_parametrizacion_x_producto;
                    cmb_PlanCta.set_PlanCtarInfo(info.P_IdCtaCble_transitoria_transf_inven);

                    cmb_dev_inven_x_ing.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing));
                    cmb_dev_inven_x_egr.set_TipoMoviInvInfo(Convert.ToInt32(info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg));

                    cmb_egreso_app.cmbCatalogo.EditValue  = info.IdMovi_inven_tipo_mobile_egr;
                    cmb_ingreso_app.cmbCatalogo.EditValue = info.IdMovi_inven_tipo_mobile_ing;
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 11
0
 public FrmIn_distribucion_x_lote_man()
 {
     InitializeComponent();
     Log_Error_bus     = new tb_sis_Log_Error_Vzen_Bus();
     param             = cl_parametrosGenerales_Bus.Instance;
     bus_distribucion  = new in_Ing_Egr_Inven_distribucion_Bus();
     info_distribucion = new in_Ing_Egr_Inven_distribucion_Info();
     blst_x_distribuir = new BindingList <in_Ing_Egr_Inven_distribucion_Info>();
     blst_distribuido  = new BindingList <in_Ing_Egr_Inven_distribucion_Info>();
     lst_unidad_medida = new List <in_UnidadMedida_Info>();
     bus_unidad_medida = new in_UnidadMedida_Bus();
     lst_retorno       = new List <in_producto_lote>();
     info_param_in     = new in_Parametro_Info();
     bus_param_in      = new in_Parametro_Bus();
     lst_motivo_inve   = new List <in_Motivo_Inven_Info>();
     bus_motivo_inve   = new in_Motivo_Inven_Bus();
 }
Exemplo n.º 12
0
        private void frmIn_Ajuste_Inventario_fisico_Load(object sender, EventArgs e)
        {
            try
            {
                Info_ParmeInven = Bus_ParamInve.Get_Info_Parametro(param.IdEmpresa);


                CargarControles();
                CargarListProd();
                set_Accion_In_Controls();
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 13
0
        public void cargaCmb_centroCostos()
        {
            try
            {
                parametro = BusParametro.Get_Info_Parametro(param.IdEmpresa);

                listCentroCosto_Info = BusCC.Get_list_Centro_costo_x_IdCuentas_Padre(parametro.IdEmpresa, parametro.IdCentroCosto_Padre_a_cargar, ref MensajeError);
                cmbCentroCosto.Properties.DataSource    = listCentroCosto_Info;
                cmbCentroCosto.Properties.DisplayMember = "Centro_costo2";
                cmbCentroCosto.Properties.ValueMember   = "IdCentroCosto";
            }
            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());
            }
        }
Exemplo n.º 14
0
        public in_Parametro_Info Get_Info_Parametro(int IdEmpresa)
        {
            try
            {
                in_Parametro_Info oinfo = new in_Parametro_Info();


                oinfo = oData.Get_Info_Parametro(IdEmpresa);
                return(oinfo);
            }
            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("", "ObtenerParametros", ex.Message), ex)
                      {
                          EntityType = typeof(in_Parametro_Bus)
                      };
            }
        }
Exemplo n.º 15
0
        public void CargarCombo()
        {
            try
            {
                Info_Patam_x_Inv = new in_Parametro_Info();
                Info_Patam_x_Inv = busInfo.Get_Info_Parametro(param.IdEmpresa);

                lstestado_apro = new List <in_Ing_Egr_Inven_estado_apro_Info>();
                lstestado_apro = UniB.Get_List_Ing_Egr_Inven_estado_apro();
                cmbEstado_Apro_x_ing_Egr_Inven.Properties.DataSource = lstestado_apro;
                cmbEstado_Apro_x_ing_Egr_Inven.EditValue             = Info_Patam_x_Inv.IdEstadoAproba_x_Ing;
            }
            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());
            }
        }
Exemplo n.º 16
0
        public frmIn_AjustesInven_Mant()
        {
            try
            {
                InitializeComponent();


                UCSucurBod.Event_cmb_sucursal_SelectionChangeCommitted += new UCIn_Sucursal_Bodega.delegate_cmb_sucursal_SelectionChangeCommitted(UCSucurBod_Event_cmb_sucursal_SelectionChangeCommitted);
                UCSucurBod.Event_cmb_bodega_SelectionChangeCommitted   += new UCIn_Sucursal_Bodega.delegate_cmb_bodega_SelectionChangeCommitted(UCSucurBod_Event_cmb_bodega_SelectionChangeCommitted);

                this.panelSucursal_bodega.Controls.Add(UCSucurBod);
                UCSucurBod.TipoCarga = Cl_Enumeradores.eTipoFiltro.Normal;
                UCSucurBod.Dock      = DockStyle.Fill;


                UCGridDetalleProduc.idBodega   = 1;
                UCGridDetalleProduc.idSucursal = 1;
                this.panelDetalleProducto.Controls.Add(UCGridDetalleProduc);
                UCGridDetalleProduc.Dock = DockStyle.Fill;

                UCCentroCosto.cargaCmb_centroCostos();
                //panelCentroCosto.Controls.Add(UCCentroCosto);
                UCCentroCosto.Dock = DockStyle.Fill;
                UCCentroCosto.Event_ultraComboE_CentroCosto_SelectionChanged += new UCCon_CentroCosto.delegateultraComboE_CentroCosto_SelectionChanged(UCCentroCosto_Event_ultraComboE_CentroCosto_SelectionChanged);;

                UCGridDetalleProduc.VisibleCodigo        = true;
                UCGridDetalleProduc.VisibleCosto         = true;
                UCGridDetalleProduc.VisiblePeso          = true;
                UCGridDetalleProduc.VisibleStockAnterior = true;
                UCGridDetalleProduc.VisibleStock         = true;


                //kft
                UCGridDetalleProduc._tipomovi = UCInv_Grid_Movi_Detalle.eTipoMovi.Ingreso;
                InfoParametro = BusParametro.ObtenerParametros(param.IdEmpresa);
                UCGridDetalleProduc.ValidaStock = (InfoParametro.Maneja_Stock_Negativo == "S") ? false : true;
                //kft
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
Exemplo n.º 17
0
        private void cargar_combos()
        {
            try
            {
                info_in_param = bus_in_param.Get_Info_Parametro(param.IdEmpresa);

                cp_codigo_SRI_Bus         dat_ti        = new cp_codigo_SRI_Bus();
                List <cp_codigo_SRI_Info> ListCodigoSRI = new List <cp_codigo_SRI_Info>();
                ListCodigoSRI = dat_ti.Get_List_codigo_SRI_(param.IdEmpresa).FindAll(c => c.co_estado == "A" && c.IdTipoSRI == "COD_IDCREDITO");

                cmbSustTrib.Properties.DataSource    = ListCodigoSRI;
                cmbSustTrib.Properties.DisplayMember = "descriConcate";
                cmbSustTrib.Properties.ValueMember   = "IdCodigo_SRI";

                cp_TipoDocumento_Bus TipDoc_B = new cp_TipoDocumento_Bus();
                LstTipDoc = TipDoc_B.Get_List_TipoDocumento().FindAll(c => c.CodSRI != "04" && c.CodSRI != "05");
                LstTipDoc.ForEach(c => c.Descripcion = "[" + c.CodSRI + "] - " + c.Descripcion);
                cmbTipoDocu.Properties.DataSource    = LstTipDoc;
                cmbTipoDocu.Properties.DisplayMember = "Descripcion";
                cmbTipoDocu.Properties.ValueMember   = "CodTipoDocumento";

                ucCp_Proveedor1.cargar_proveedores();
                ucIn_Sucursal_Bodega1.set_Idsucursal(param.IdSucursal);

                lst_impuesto = bus_impuesto.Get_List_impuesto("IVA");
                cmb_impuesto_iva.DataSource = lst_impuesto;

                ucIn_TipoMoviInv_Cmb1.cargar_TipoMotivo(0, 0, "+", "");
                ucIn_TipoMoviInv_Cmb1.set_TipoMoviInvInfo(info_in_param.P_IdMovi_inven_tipo_ingreso_x_compra == null ? 0 : Convert.ToInt32(info_in_param.P_IdMovi_inven_tipo_ingreso_x_compra));
                gridControl_aprobacion.DataSource = blst_det;

                lst_unidad_medida            = bus_unidad_medida.Get_list_UnidadMedida();
                cmb_unidad_medida.DataSource = lst_unidad_medida;

                de_fecha.DateTime = DateTime.Now.Date;
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 18
0
 private void GridFacturaDevExpres_Load(object sender, EventArgs e)
 {
     try
     {
         DataSource      = new BindingList <fa_factura_det_info>();
         in_param_I      = in_param_B.Get_Info_Parametro(param.IdEmpresa);
         parametros_Info = parametros.Get_Info_parametro(param.IdEmpresa);
         for (int i = 0; i < parametros_Info.NumeroDeItemFact; i++)
         {
             DataSource.Add(new fa_factura_det_info());
         }
         gridControl.DataSource = DataSource;
     }
     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());
     }
 }
Exemplo n.º 19
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();
 }
Exemplo n.º 20
0
 public in_Parametro_Info Get_Info_Parametro(int IdEmpresa)
 {
     try
     {
         in_Parametro_Info  Cbt        = null;
         EntitiesInventario param_Info = new EntitiesInventario();
         var selectBaParam             = from C in param_Info.in_parametro
                                         where C.IdEmpresa == IdEmpresa
                                         select C;
         foreach (var item in selectBaParam)
         {
             Cbt = new in_Parametro_Info();
             Cbt.IdCentroCosto_Padre_a_cargar           = item.IdCentroCosto_Padre_a_cargar;
             Cbt.LabelCentroCosto                       = item.LabelCentroCosto;
             Cbt.IdMovi_inven_tipo_egresoBodegaOrigen   = Convert.ToInt32(item.IdMovi_inven_tipo_egresoBodegaOrigen);
             Cbt.IdMovi_inven_tipo_ingresoBodegaDestino = Convert.ToInt32(item.IdMovi_inven_tipo_ingresoBodegaDestino);
             Cbt.Maneja_Stock_Negativo                  = item.Maneja_Stock_Negativo;
             Cbt.Usuario_Escoge_Motivo                  = item.Usuario_Escoge_Motivo;
             Cbt.IdMovi_inven_tipo_egresoAjuste         = Convert.ToInt32(item.IdMovi_inven_tipo_egresoAjuste);
             Cbt.IdMovi_inven_tipo_ingresoAjuste        = Convert.ToInt32(item.IdMovi_inven_tipo_ingresoAjuste);
             Cbt.Mostrar_CentroCosto_en_transacciones   = item.Mostrar_CentroCosto_en_transacciones;
             Cbt.Rango_Busqueda_Transacciones           = Convert.ToInt32(item.Rango_Busqueda_Transacciones);
             Cbt.ApruebaAjusteFisicoAuto                = item.ApruebaAjusteFisicoAuto;
             Cbt.IdEmpresa                              = IdEmpresa;
             Cbt.IdCtaCble_Inven                        = item.IdCtaCble_Inven;
             Cbt.IdCtaCble_CostoInven                   = item.IdCtaCble_CostoInven;
             Cbt.IdCentro_Costo_Costo                   = item.IdCentro_Costo_Costo;
             Cbt.IdCentro_Costo_Inventario              = item.IdCentro_Costo_Inventario;
             Cbt.IdTipoCbte_CostoInven                  = item.IdTipoCbte_CostoInven;
             Cbt.IdTipoCbte_CostoInven_Reverso          = item.IdTipoCbte_CostoInven_Reverso;
             Cbt.IdMovi_Inven_tipo_x_anu_Egr            = item.IdMovi_Inven_tipo_x_anu_Egr;
             Cbt.IdMovi_Inven_tipo_x_anu_Ing            = item.IdMovi_Inven_tipo_x_anu_Ing;
             Cbt.IdSucursalSuministro                   = Convert.ToInt32(item.IdSucursal_Suministro);
             Cbt.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = item.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa;
             Cbt.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = item.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa;
             Cbt.IdSucursalSuministro                   = Convert.ToInt32(item.IdSucursal_Suministro);
             Cbt.IdBodegaSuministro                     = Convert.ToInt32(item.IdBodegaSuministro);
             Cbt.IdTipoCbte_CostoInven                  = item.IdTipoCbte_CostoInven;
             Cbt.IdTipoCbte_CostoInven_Reverso          = item.IdTipoCbte_CostoInven_Reverso;
             Cbt.IdMovi_Inven_tipo_x_anu_Ing            = (item.IdMovi_Inven_tipo_x_anu_Ing);
             Cbt.IdMovi_Inven_tipo_x_anu_Egr            = (item.IdMovi_Inven_tipo_x_anu_Egr);
             Cbt.IdEstadoAproba_x_Ing                   = item.IdEstadoAproba_x_Ing;
             Cbt.IdEstadoAproba_x_Egr                   = item.IdEstadoAproba_x_Egr;
             Cbt.P_Grabar_Items_x_Cada_Movi_Inven       = item.P_Grabar_Items_x_Cada_Movi_Inven;
             Cbt.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg      = item.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg;
             Cbt.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing      = item.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing;
             Cbt.P_Fecha_para_contabilizacion_ingr_egr  = item.P_Fecha_para_contabilizacion_ingr_egr;
             Cbt.P_se_valida_parametrizacion_x_producto = item.P_se_valida_parametrizacion_x_producto;
             Cbt.P_IdCtaCble_transitoria_transf_inven   = item.P_IdCtaCble_transitoria_transf_inven;
             Cbt.IdMovi_inven_tipo_mobile_ing           = item.IdMovi_inven_tipo_mobile_ing;
             Cbt.IdMovi_inven_tipo_mobile_egr           = item.IdMovi_inven_tipo_mobile_egr;
         }
         return(Cbt);
     }
     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() + " " + ex.Message;
         throw new Exception(mensaje);
     }
 }
Exemplo n.º 21
0
        public Boolean ModificarDB(in_Parametro_Info info, int IdEmpresa)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    EntitiesInventario param_Info = new EntitiesInventario();
                    var selectBaParam             = (from C in param_Info.in_parametro
                                                     where C.IdEmpresa == IdEmpresa
                                                     select C).Count();
                    if (selectBaParam == 0)
                    {
                        var addressG = new in_parametro();
                        addressG.IdEmpresa = IdEmpresa;
                        addressG.IdCentroCosto_Padre_a_cargar           = (info.IdCentroCosto_Padre_a_cargar == "") ? null : info.IdCentroCosto_Padre_a_cargar;
                        addressG.LabelCentroCosto                       = info.LabelCentroCosto;
                        addressG.IdMovi_inven_tipo_egresoBodegaOrigen   = info.IdMovi_inven_tipo_egresoBodegaOrigen;
                        addressG.IdMovi_inven_tipo_ingresoBodegaDestino = info.IdMovi_inven_tipo_ingresoBodegaDestino;
                        addressG.Maneja_Stock_Negativo                  = info.Maneja_Stock_Negativo;
                        addressG.Usuario_Escoge_Motivo                  = info.Usuario_Escoge_Motivo;
                        addressG.IdMovi_inven_tipo_egresoAjuste         = info.IdMovi_inven_tipo_egresoAjuste;
                        addressG.IdMovi_inven_tipo_ingresoAjuste        = info.IdMovi_inven_tipo_ingresoAjuste;
                        addressG.Mostrar_CentroCosto_en_transacciones   = info.Mostrar_CentroCosto_en_transacciones;
                        addressG.Rango_Busqueda_Transacciones           = info.Rango_Busqueda_Transacciones;
                        addressG.ApruebaAjusteFisicoAuto                = info.ApruebaAjusteFisicoAuto;


                        addressG.IdCtaCble_Inven           = (info.IdCtaCble_Inven == "") ? null : info.IdCtaCble_Inven;
                        addressG.IdCtaCble_CostoInven      = (info.IdCtaCble_CostoInven == "") ? null : info.IdCtaCble_CostoInven;
                        addressG.IdCentro_Costo_Costo      = (info.IdCentro_Costo_Costo == "") ? null : info.IdCentro_Costo_Costo;
                        addressG.IdCentro_Costo_Inventario = (info.IdCentro_Costo_Inventario == "") ? null : info.IdCentro_Costo_Inventario;

                        addressG.IdSucursal_Suministro = info.IdSucursalSuministro;

                        if (info.IdTipoCbte_CostoInven != 0)
                        {
                            addressG.IdTipoCbte_CostoInven = info.IdTipoCbte_CostoInven;
                        }
                        if (info.IdTipoCbte_CostoInven_Reverso != 0)
                        {
                            addressG.IdTipoCbte_CostoInven_Reverso = info.IdTipoCbte_CostoInven_Reverso;
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Ing != 0)
                        {
                            addressG.IdMovi_Inven_tipo_x_anu_Ing = (info.IdMovi_Inven_tipo_x_anu_Ing);
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Egr != 0)
                        {
                            addressG.IdMovi_Inven_tipo_x_anu_Egr = (info.IdMovi_Inven_tipo_x_anu_Egr);
                        }

                        if (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa != 0)
                        {
                            addressG.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa);
                        }
                        if (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa != 0)
                        {
                            addressG.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa);
                        }

                        addressG.IdEstadoAproba_x_Ing = info.IdEstadoAproba_x_Ing;
                        addressG.IdEstadoAproba_x_Egr = info.IdEstadoAproba_x_Egr;

                        addressG.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg      = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg;
                        addressG.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing      = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing;
                        addressG.P_Grabar_Items_x_Cada_Movi_Inven       = info.P_Grabar_Items_x_Cada_Movi_Inven;
                        addressG.P_Fecha_para_contabilizacion_ingr_egr  = info.P_Fecha_para_contabilizacion_ingr_egr;
                        addressG.P_se_valida_parametrizacion_x_producto = (info.P_se_valida_parametrizacion_x_producto == null) ? false : Convert.ToBoolean(info.P_se_valida_parametrizacion_x_producto);

                        addressG.P_IdCtaCble_transitoria_transf_inven = (info.P_IdCtaCble_transitoria_transf_inven == null) ? null : Convert.ToString(info.P_IdCtaCble_transitoria_transf_inven);
                        addressG.IdMovi_inven_tipo_mobile_ing         = info.IdMovi_inven_tipo_mobile_ing;
                        addressG.IdMovi_inven_tipo_mobile_egr         = info.IdMovi_inven_tipo_mobile_egr;
                        context.in_parametro.Add(addressG);
                        context.SaveChanges();
                    }
                    else
                    {
                        var contact = context.in_parametro.First(para => para.IdEmpresa == IdEmpresa);
                        contact.IdEmpresa = IdEmpresa;
                        contact.IdCentroCosto_Padre_a_cargar           = info.IdCentroCosto_Padre_a_cargar;
                        contact.LabelCentroCosto                       = info.LabelCentroCosto;
                        contact.IdMovi_inven_tipo_egresoBodegaOrigen   = info.IdMovi_inven_tipo_egresoBodegaOrigen;
                        contact.IdMovi_inven_tipo_ingresoBodegaDestino = info.IdMovi_inven_tipo_ingresoBodegaDestino;
                        contact.Maneja_Stock_Negativo                  = info.Maneja_Stock_Negativo;
                        contact.IdSucursal_Suministro                  = info.IdSucursalSuministro;
                        contact.Usuario_Escoge_Motivo                  = info.Usuario_Escoge_Motivo;
                        contact.IdMovi_inven_tipo_egresoAjuste         = info.IdMovi_inven_tipo_egresoAjuste;
                        contact.IdMovi_inven_tipo_ingresoAjuste        = info.IdMovi_inven_tipo_ingresoAjuste;
                        contact.Mostrar_CentroCosto_en_transacciones   = info.Mostrar_CentroCosto_en_transacciones;
                        contact.Rango_Busqueda_Transacciones           = info.Rango_Busqueda_Transacciones;
                        contact.ApruebaAjusteFisicoAuto                = info.ApruebaAjusteFisicoAuto;
                        contact.IdSucursal_Suministro                  = info.IdSucursalSuministro;
                        contact.IdBodegaSuministro                     = info.IdBodegaSuministro;

                        contact.IdCentro_Costo_Costo      = (info.IdCentro_Costo_Costo == "") ? null : info.IdCentro_Costo_Costo;
                        contact.IdCentro_Costo_Inventario = (info.IdCentro_Costo_Inventario == "") ? null : info.IdCentro_Costo_Inventario;

                        contact.IdCtaCble_Inven      = info.IdCtaCble_Inven;
                        contact.IdCtaCble_CostoInven = info.IdCtaCble_CostoInven;
                        contact.IdEstadoAproba_x_Ing = info.IdEstadoAproba_x_Ing;
                        contact.IdEstadoAproba_x_Egr = info.IdEstadoAproba_x_Egr;

                        if (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa != 0)
                        {
                            contact.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa);
                        }
                        if (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa != 0)
                        {
                            contact.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa);
                        }

                        if (info.IdTipoCbte_CostoInven != 0)
                        {
                            contact.IdTipoCbte_CostoInven = info.IdTipoCbte_CostoInven;
                        }
                        if (info.IdTipoCbte_CostoInven_Reverso != 0)
                        {
                            contact.IdTipoCbte_CostoInven_Reverso = info.IdTipoCbte_CostoInven_Reverso;
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Ing != 0)
                        {
                            contact.IdMovi_Inven_tipo_x_anu_Ing = (info.IdMovi_Inven_tipo_x_anu_Ing);
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Egr != 0)
                        {
                            contact.IdMovi_Inven_tipo_x_anu_Egr = (info.IdMovi_Inven_tipo_x_anu_Egr);
                        }
                        contact.P_Grabar_Items_x_Cada_Movi_Inven       = info.P_Grabar_Items_x_Cada_Movi_Inven;
                        contact.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg      = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg;
                        contact.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing      = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing;
                        contact.P_Fecha_para_contabilizacion_ingr_egr  = info.P_Fecha_para_contabilizacion_ingr_egr;
                        contact.P_se_valida_parametrizacion_x_producto = (info.P_se_valida_parametrizacion_x_producto == null) ? false : Convert.ToBoolean(info.P_se_valida_parametrizacion_x_producto);

                        contact.IdMovi_inven_tipo_mobile_ing         = info.IdMovi_inven_tipo_mobile_ing;
                        contact.IdMovi_inven_tipo_mobile_egr         = info.IdMovi_inven_tipo_mobile_egr;
                        contact.P_IdCtaCble_transitoria_transf_inven = (info.P_IdCtaCble_transitoria_transf_inven == null) ? null : Convert.ToString(info.P_IdCtaCble_transitoria_transf_inven);


                        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() + " " + ex.Message;
                throw new Exception(mensaje);
            }
        }
Exemplo n.º 22
0
        public void getParametrosInventario()
        {
            try
            {
                if (info == null)
                {
                    info = new in_Parametro_Info();
                }

                info.Maneja_Stock_Negativo         = (cmbStockNeg.SelectedItem == "Si") ? "S" : "N";
                info.Usuario_Escoge_Motivo         = (cmbUsuatioEscogeMot.SelectedItem == "Si") ? "S" : "N";
                info.IdTipoCbte_CostoInven         = cmbTipoCbteCble_Trans_costo_Inven.get_TipoCbteCble().IdTipoCbte;
                info.IdTipoCbte_CostoInven_Reverso = cmbTipoCbteCble_Trans_Anu_costo_Inven.get_TipoCbteCble().IdTipoCbte;
                info.IdCtaCble_Inven      = cmb_ctacble_Inven.get_PlanCtaInfo().IdCtaCble;
                info.IdCtaCble_CostoInven = cmb_ctacble_costo_inven.get_PlanCtaInfo().IdCtaCble;


                info.IdMovi_Inven_tipo_x_anu_Ing            = cmb_tipo_movi_inven_anu_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_x_anu_Egr            = cmb_tipo_movi_inven_anu_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_inven_tipo_ingresoBodegaDestino = cmb_tipo_movi_inven_x_transf_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_inven_tipo_egresoBodegaOrigen   = cmb_tipo_movi_inven_x_transf_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = cmb_tipo_movi_inven_egr_x_ajus_fisico.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = cmb_tipo_movi_inven_ing_x_ajus_fisico.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.ApruebaAjusteFisicoAuto                = (ckAjust.Checked == true ? "S" : "N");
                info.IdMovi_inven_tipo_ingresoAjuste        = cmb_tipo_movi_inven_ing_x_ajus.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_inven_tipo_egresoAjuste         = cmb_tipo_movi_inven_egr_x_ajus.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdEstadoAproba_x_Ing                   = Convert.ToString(cmbEstadoAproba_Ingr.EditValue);
                info.IdEstadoAproba_x_Egr                   = Convert.ToString(cmbEstadoAproba_Egre.EditValue);
                info.P_Fecha_para_contabilizacion_ingr_egr  = cmb_catalogo_Fecha_conta.Get_CatalogosInfo().IdCatalogo;
                info.P_se_valida_parametrizacion_x_producto = chk_para_conta_oblig_produ_ten_ctaInv.Checked;

                info.P_IdCtaCble_transitoria_transf_inven = cmb_PlanCta.get_PlanCtaInfo().IdCtaCble;

                info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing = cmb_dev_inven_x_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg = cmb_dev_inven_x_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;

                info.IdMovi_inven_tipo_x_distribucion_egr = cmb_tipo_movi_distribucion_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.IdMovi_inven_tipo_x_distribucion_ing = cmb_tipo_movi_distribucion_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;

                info.P_se_crea_lote_0_al_crear_producto_matriz = chk_crear_lote_0_automatico.Checked;
                if (cmb_tipo_producto_lote.get_TipoProductoInfo() != null)
                {
                    info.P_IdProductoTipo_para_lote_0 = cmb_tipo_producto_lote.get_TipoProductoInfo().IdProductoTipo;
                }
                else
                {
                    info.P_IdProductoTipo_para_lote_0 = null;
                }

                info.P_IdMovi_inven_tipo_default_egr      = cmb_tipo_movi_default_egr.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.P_IdMovi_inven_tipo_default_ing      = cmb_tipo_movi_default_ing.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.P_IdMovi_inven_tipo_ingreso_x_compra = cmb_tipo_movi_ing_x_compras.get_TipoMoviInvInfo().IdMovi_inven_tipo;
                info.P_Dias_menores_alerta_desde_fecha_actual_amarillo = Convert.ToInt32(spinEdit_dias_amarillo.EditValue);
                info.P_Dias_menores_alerta_desde_fecha_actual_rojo     = Convert.ToInt32(spinEdit_dias_rojo.EditValue);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 23
0
        public Boolean Liquidar(imp_ordencompra_ext_Info Obj, ref string mensaje, Cl_Enumeradores.eTipo_action accion)
        {
            try
            {
                decimal IdCbteLiquidacion = 0;

                ct_Cbtecble_det_Info                _detCbteCble_Info  = new ct_Cbtecble_det_Info();
                List <ct_Cbtecble_det_Info>         LstCbteCble        = new List <ct_Cbtecble_det_Info>();
                ct_Cbtecble_Info                    CbteCble_I         = new ct_Cbtecble_Info();
                imp_ordencompra_ext_det_Bus         ImporDet_bus       = new imp_ordencompra_ext_det_Bus();
                List <imp_ordencompra_ext_det_Info> ListInfo_det_Impor = new List <imp_ordencompra_ext_det_Info>();
                in_categorias_data                  dataCategoria      = new in_categorias_data();
                ct_Periodo_Bus  Per_B = new ct_Periodo_Bus();
                ct_Periodo_Info Per_I = new ct_Periodo_Info();

                in_Parametro_Data       dataInParametro                    = new in_Parametro_Data();
                imp_ordencompra_ext_Bus BusImportacion                     = new imp_ordencompra_ext_Bus();
                ct_Cbtecble_Bus         Buscbte                            = new ct_Cbtecble_Bus();
                imp_ordencompra_ext_x_ct_cbtecble_Bus BusOrdxCbt           = new imp_ordencompra_ext_x_ct_cbtecble_Bus();
                ct_cbtecble_Reversado_Bus             BusReverso           = new ct_cbtecble_Reversado_Bus();
                imp_Parametros_Info                    tip                 = new imp_Parametros_Info();
                imp_Parametros_Bus                     Data_parametros     = new imp_Parametros_Bus();
                cl_parametrosGenerales_Bus             param               = cl_parametrosGenerales_Bus.Instance;
                imp_ordencompra_ext_x_ct_cbtecble_Info ordCompraxCbte_info = new imp_ordencompra_ext_x_ct_cbtecble_Info();

                tip = Data_parametros.Get_Info_Parametros(param.IdEmpresa);

                ordCompraxCbte_info.ct_IdEmpresa         = ordCompraxCbte_info.imp_IdEmpresa = param.IdEmpresa;
                ordCompraxCbte_info.imp_IdOrdenCompraExt = Obj.IdOrdenCompraExt;
                ordCompraxCbte_info.imp_IdSucusal        = Obj.IdSucusal;

                //   var DiarioLiqui = BusImportacion.consultaDiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI")
                //   var CobteLiquidacion = Buscbte.ObtenerObjeto(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte);


                switch (accion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:

                    if (Obj.ci_tonelaje == null || Obj.ci_tonelaje == 0)
                    {
                        mensaje = "Error al generar Diario de Importación ya que no se puede dividir el total de liquidación para un valor de tonelaje = 0 ";
                    }
                    else
                    {
                        string  cod_CbteCble = "";
                        decimal idCbteCble   = 0;
                        string  MensajeError = "";

                        cp_proveedor_Data _Prove_D = new cp_proveedor_Data();
                        var proveedor = _Prove_D.Get_Info_Proveedor(param.IdEmpresa, Obj.IdProveedor);

                        Per_I = Per_B.Get_Info_Periodo(Obj.IdEmpresa, Obj.ci_fecha_liquidacion, ref MensajeError);

                        string Observacion = "Cont. x Imp. #" + Obj.CodOrdenCompraExt + "'\'" + Obj.IdOrdenCompraExt + " Liquidacion de Importacion :" + proveedor.pr_nombre + "//" + Obj.ci_Observacion;
                        ListInfo_det_Impor = ImporDet_bus.Get_List_ordencompra_ext_det(Obj);

                        int contItems = ListInfo_det_Impor.Count();

                        foreach (var item in ListInfo_det_Impor)
                        {
                            _detCbteCble_Info = new ct_Cbtecble_det_Info();

                            var Categoria = dataCategoria.Get_Info_categorias(param.IdEmpresa, item.IdCategoria);

                            if (Categoria.IdCtaCtble_Inve == null)
                            {
                                in_Parametro_Info Info_InParametro = new in_Parametro_Info();

                                Info_InParametro = dataInParametro.Get_Info_Parametro(param.IdEmpresa);

                                _detCbteCble_Info.IdCtaCble      = Info_InParametro.IdCtaCble_Inven;
                                _detCbteCble_Info.dc_Observacion = "Cta. Ctble tomada de los parámetros de inventario / " + Observacion;
                            }
                            else
                            {
                                _detCbteCble_Info.IdCtaCble      = Categoria.IdCtaCtble_Inve;
                                _detCbteCble_Info.dc_Observacion = Observacion;
                            }
                            _detCbteCble_Info.IdEmpresa  = param.IdEmpresa;
                            _detCbteCble_Info.IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion;
                            _detCbteCble_Info.dc_Valor   = Convert.ToDouble(item.di_subtotal) + (Obj.TotGastosImp / contItems); // debe
                            LstCbteCble.Add(_detCbteCble_Info);
                        }

                        ct_Cbtecble_det_Info obj2 = new ct_Cbtecble_det_Info();
                        obj2.IdCtaCble      = Obj.IdCtaCble_import;
                        obj2.dc_Observacion = Observacion;//"Contabilizacion por Importacion Diario Importacion FOB" + Obj.ci_Observacion;
                        obj2.IdCtaCble      = Obj.IdCtaCble_import;
                        obj2.IdTipoCbte     = tip.IdTipoCbte_DiarioLiquidacion;
                        obj2.IdEmpresa      = Obj.IdEmpresa;

                        obj2.dc_Valor = Obj.TotalLiquidacion * -1; //haber

                        LstCbteCble.Add(obj2);

                        // cabecer ade diario
                        CbteCble_I.IdEmpresa                = param.IdEmpresa;
                        CbteCble_I.IdTipoCbte               = tip.IdTipoCbte_DiarioLiquidacion;
                        CbteCble_I.CodCbteCble              = "IM";
                        CbteCble_I.IdPeriodo                = Per_I.IdPeriodo;
                        CbteCble_I.cb_Fecha                 = Obj.ci_fecha_liquidacion;
                        CbteCble_I.cb_Observacion           = Observacion;// "Cont. de la  Importacion #" + Obj.CodOrdenCompraExt + " Diario FOB" + Obj.ci_Observacion + Categoria.ca_Categoria;
                        CbteCble_I.Secuencia                = 0;
                        CbteCble_I.Estado                   = "A";
                        CbteCble_I.Anio                     = Obj.ci_fecha.Year;
                        CbteCble_I.Mes                      = Obj.ci_fecha.Month;
                        CbteCble_I.IdUsuario                = param.IdUsuario;
                        CbteCble_I.IdUsuarioUltModi         = param.IdUsuario;
                        CbteCble_I.cb_FechaTransac          = param.GetDateServer();
                        CbteCble_I.cb_FechaUltModi          = param.GetDateServer();
                        CbteCble_I.Mayorizado               = "N";
                        CbteCble_I.cb_Valor                 = Obj.TotalLiquidacion;
                        CbteCble_I._cbteCble_det_lista_info = LstCbteCble;

                        Buscbte.GrabarDB(CbteCble_I, ref idCbteCble, ref MensajeError);
                        IdCbteLiquidacion = idCbteCble;

                        ordCompraxCbte_info.ct_IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion;
                        ordCompraxCbte_info.ct_IdCbteCble = idCbteCble;
                        ordCompraxCbte_info.TipoReg       = "LQUI";
                        BusOrdxCbt.GuardarDB(ordCompraxCbte_info, ref MensajeError);

                        var DiarioLiqui      = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI");
                        var Diario_Reverso   = BusReverso.Get_Info_cbtecble_Reversado(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte);
                        var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje);
                        Obj.CodCbteCble = CobteLiquidacion.CodCbteCble.ToString();

                        return(oData.Liquidar(Obj, ref mensaje));
                    }

                    break;

                case Cl_Enumeradores.eTipo_action.Anular:

                    decimal IdComprobanteAnulado = 0;
                    string  msj = "";
                    if (IdCbteLiquidacion == 0)
                    {
                        var DiarioLiqui      = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI");
                        var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje);
                        IdCbteLiquidacion = CobteLiquidacion.IdCbteCble;
                    }

                    string motiAnulacion = Obj.motiAnulacion;

                    if (Buscbte.ReversoCbteCble(param.IdEmpresa, IdCbteLiquidacion, tip.IdTipoCbte_DiarioLiquidacion, tip.IdTipoCbte_DiarioLiquidacion_Anul, ref IdComprobanteAnulado, ref msj, param.IdUsuario, motiAnulacion))
                    {
                        // MessageBox.Show("Anulado");
                        mensaje = "*** Anulado ***";

                        ordCompraxCbte_info.ct_IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion_Anul;
                        ordCompraxCbte_info.ct_IdCbteCble = IdComprobanteAnulado;
                        ordCompraxCbte_info.TipoReg       = "ALQUI";
                        BusOrdxCbt.GuardarDB(ordCompraxCbte_info, ref msj);

                        var DiarioLiqui      = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI");
                        var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje);

                        var Diario_Reverso = BusReverso.Get_Info_cbtecble_Reversado(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte);

                        if (Diario_Reverso.IdTipoCbte_Anu != 0)
                        {
                            var CobteLiquidacionAnulado = Buscbte.Get_Info_CbteCble(param.IdEmpresa, Diario_Reverso.IdTipoCbte_Anu, Diario_Reverso.IdCbteCble_Anu, ref mensaje);

                            Obj.msgAnuladoReverso = "**Anulado ** Reversado Con diario" + "\n" + CobteLiquidacionAnulado.CodCbteCble;
                        }
                        return(oData.Liquidar(Obj, ref mensaje));
                    }

                    break;

                default:

                    break;
                }


                return(true);
            }
            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("", "Liquidar", ex.Message), ex)
                      {
                          EntityType = typeof(imp_ordencompra_ext_Bus)
                      };
            }
        }
        public Boolean ModificarDB(in_Ing_Egr_Inven_Info info, ref string msgs)
        {
            try
            {
                in_Ing_Egr_Inven_det_Data dataDet   = new in_Ing_Egr_Inven_det_Data();
                in_Parametro_Bus          busParam  = new in_Parametro_Bus();
                in_Parametro_Info         infoParam = new in_Parametro_Info();
                string IdEstadoAproba_Param         = "";
                infoParam = busParam.Get_Info_Parametro(info.IdEmpresa);
                if (InfoParam.IdEmpresa == 0)
                {
                    return(false);
                }
                if (info.signo == "+")
                {
                    IdEstadoAproba_Param = infoParam.IdEstadoAproba_x_Ing;
                }
                else
                {
                    IdEstadoAproba_Param = infoParam.IdEstadoAproba_x_Egr;
                }

                Boolean res = false;

                if (Validar_objeto_IngEgr(info, ref mensaje))
                {
                    //arreglando los id del detalle en caso q no venga sin id
                    foreach (var item in info.listIng_Egr)
                    {
                        item.IdEmpresa         = info.IdEmpresa;
                        item.IdSucursal        = info.IdSucursal;
                        item.IdNumMovi         = info.IdNumMovi;
                        item.IdMovi_inven_tipo = info.IdMovi_inven_tipo;
                        item.signo             = info.signo;

                        in_producto_Bus  BusProducto = new in_producto_Bus();
                        in_Producto_Info InfoProdu   = BusProducto.Get_info_Product(info.IdEmpresa, item.IdProducto);

                        if (item.IdEstadoAproba == null || item.IdEstadoAproba == "")
                        {
                            if (info.signo == "+")
                            {
                                IdEstadoAproba_Param = infoParam.IdEstadoAproba_x_Ing;
                            }
                            else
                            {
                                IdEstadoAproba_Param = infoParam.IdEstadoAproba_x_Egr;
                            }
                            item.IdEstadoAproba = Get_EstadoApro(Convert.ToInt32(info.IdEmpresa), Convert.ToInt32(info.IdSucursal), Convert.ToInt32(info.IdBodega), IdEstadoAproba_Param);
                        }
                        if (item.IdUnidadMedida_sinConversion == null || item.IdUnidadMedida_sinConversion == "" || item.IdUnidadMedida == null || item.IdUnidadMedida == "")
                        {
                            item.IdUnidadMedida               = InfoProdu.IdUnidadMedida;
                            item.IdUnidadMedida_Consumo       = InfoProdu.IdUnidadMedida_Consumo;
                            item.IdUnidadMedida_sinConversion = InfoProdu.IdUnidadMedida;
                        }
                        if (item.mv_costo_sinConversion == 0 || item.signo == "-")
                        {
                            in_producto_x_tb_bodega_Costo_Historico_Bus  BusProd_x_Costo     = new in_producto_x_tb_bodega_Costo_Historico_Bus();
                            in_producto_x_tb_bodega_Costo_Historico_Info Info_Produc_x_Costo = new in_producto_x_tb_bodega_Costo_Historico_Info();
                            Info_Produc_x_Costo         = BusProd_x_Costo.get_UltimoCosto_x_Producto_Bodega(item.IdEmpresa, item.IdSucursal, Convert.ToInt32(item.IdBodega), item.IdProducto, info.cm_fecha);
                            item.mv_costo               = Info_Produc_x_Costo.costo;
                            item.mv_costo_sinConversion = Info_Produc_x_Costo.costo;
                        }
                        #region Convierte costo y cantidad en la unidad de consumo
                        ValorEquiv          = 0;
                        InfoUni_Equiv       = busUni_Equiv.Get_Info_in_UnidadMedida_Equiv_conversion(item.IdUnidadMedida_sinConversion, InfoProdu.IdUnidadMedida_Consumo);
                        ValorEquiv          = InfoUni_Equiv.valor_equiv == 0 ? 1 : InfoUni_Equiv.valor_equiv;
                        item.dm_cantidad    = item.dm_cantidad_sinConversion * ValorEquiv;
                        item.mv_costo       = item.mv_costo_sinConversion / ValorEquiv;
                        item.IdUnidadMedida = InfoProdu.IdUnidadMedida_Consumo;
                        #endregion
                    }

                    if (dataDet.EliminarDB(info.IdEmpresa, info.IdSucursal, info.IdMovi_inven_tipo, info.IdNumMovi, ref msgs))
                    {
                        info.IdUsuarioUltModi = param.IdUsuario;

                        if (odata.ModificarDB(info, ref msgs))
                        {
                            foreach (var item in info.listIng_Egr)
                            {
                                item.Secuencia      = 0;
                                item.IdEstadoAproba = Get_EstadoApro(Convert.ToInt32(info.IdEmpresa), Convert.ToInt32(info.IdSucursal), Convert.ToInt32(info.IdBodega), IdEstadoAproba_Param);

                                if (item.IdEmpresa == null || item.IdEmpresa == 0)
                                {
                                    item.IdEmpresa = Convert.ToInt32(info.IdEmpresa);
                                }

                                if (item.IdSucursal == null || item.IdSucursal == 0)
                                {
                                    item.IdSucursal = Convert.ToInt32(info.IdSucursal);
                                }

                                if (item.IdBodega == null || item.IdBodega == 0)
                                {
                                    item.IdBodega = Convert.ToInt32(info.IdBodega);
                                }

                                if (item.IdMovi_inven_tipo == null || item.IdMovi_inven_tipo == 0)
                                {
                                    item.IdMovi_inven_tipo = Convert.ToInt32(info.IdMovi_inven_tipo);
                                }

                                if (item.IdNumMovi == null || item.IdNumMovi == 0)
                                {
                                    item.IdNumMovi = Convert.ToInt32(info.IdNumMovi);
                                }
                            }

                            if (dataDet.GuardarDB(info.listIng_Egr))
                            {
                                res = true;
                                res = procesoGenerarMoviInve(info, info.IdNumMovi, ref mensaje);
                            }
                        }
                    }
                }

                return(res);
            }
            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("", "ModificarDB", ex.Message), ex)
                      {
                          EntityType = typeof(in_Ing_Egr_Inven_Bus)
                      };
            }
        }
        public Boolean GuardarDB(in_Ing_Egr_Inven_Info info, ref decimal IdNumMovi, ref string mensaje)
        {
            try
            {
                Boolean res = true;

                InfoParam = busParam.Get_Info_Parametro(info.IdEmpresa);

                if (Validar_objeto_IngEgr(info, ref mensaje))
                {
                    foreach (var item in info.listIng_Egr)
                    {
                        in_producto_Bus  BusProducto = new in_producto_Bus();
                        in_Producto_Info InfoProdu   = BusProducto.Get_info_Product(info.IdEmpresa, item.IdProducto);
                        item.signo = info.signo;

                        if (item.IdEstadoAproba == null || item.IdEstadoAproba == "")
                        {
                            if (info.signo == "+")
                            {
                                IdEstadoAproba_Param = InfoParam.IdEstadoAproba_x_Ing;
                            }
                            else
                            {
                                IdEstadoAproba_Param = InfoParam.IdEstadoAproba_x_Egr;
                            }
                            item.IdEstadoAproba = Get_EstadoApro(Convert.ToInt32(info.IdEmpresa), Convert.ToInt32(info.IdSucursal), Convert.ToInt32(info.IdBodega), IdEstadoAproba_Param);
                        }
                        if (item.IdUnidadMedida_sinConversion == null || item.IdUnidadMedida_sinConversion == "")
                        {
                            item.IdUnidadMedida               = InfoProdu.IdUnidadMedida;
                            item.IdUnidadMedida_Consumo       = InfoProdu.IdUnidadMedida_Consumo;
                            item.IdUnidadMedida_sinConversion = InfoProdu.IdUnidadMedida;
                        }
                        if (/*item.mv_costo_sinConversion == 0 ||*/ item.signo == "-")
                        {
                            in_producto_x_tb_bodega_Costo_Historico_Bus  BusProd_x_Costo     = new in_producto_x_tb_bodega_Costo_Historico_Bus();
                            in_producto_x_tb_bodega_Costo_Historico_Info Info_Produc_x_Costo = new in_producto_x_tb_bodega_Costo_Historico_Info();
                            Info_Produc_x_Costo         = BusProd_x_Costo.get_UltimoCosto_x_Producto_Bodega(item.IdEmpresa, item.IdSucursal, Convert.ToInt32(item.IdBodega), item.IdProducto, info.cm_fecha);
                            item.mv_costo               = Info_Produc_x_Costo.costo;
                            item.mv_costo_sinConversion = Info_Produc_x_Costo.costo;
                        }

                        #region Convierte costo y cantidad en la unidad de consumo
                        ValorEquiv          = 0;
                        InfoUni_Equiv       = busUni_Equiv.Get_Info_in_UnidadMedida_Equiv_conversion(item.IdUnidadMedida_sinConversion, InfoProdu.IdUnidadMedida_Consumo);
                        ValorEquiv          = InfoUni_Equiv.valor_equiv == 0 ? 1 : InfoUni_Equiv.valor_equiv;
                        item.dm_cantidad    = item.dm_cantidad_sinConversion * ValorEquiv;
                        item.mv_costo       = item.signo == "-" ? item.mv_costo_sinConversion : (item.mv_costo_sinConversion * item.dm_cantidad_sinConversion) / item.dm_cantidad;
                        item.IdUnidadMedida = InfoProdu.IdUnidadMedida_Consumo;
                        #endregion
                    }
                    if (res = odata.GuardarDB(info, ref IdNumMovi, ref mensaje))
                    {
                        res = procesoGenerarMoviInve(info, IdNumMovi, ref mensaje);
                    }
                }
                else
                {
                    res = false;
                }

                return(res);
            }
            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("", "GuardarDB", ex.Message), ex)
                      {
                          EntityType = typeof(in_Ing_Egr_Inven_Bus)
                      };
            }
        }
        public Boolean procesoGenerarMoviInve(in_Ing_Egr_Inven_Info info, decimal IdNumMovi, ref string mensajeError)
        {
            try
            {
                Boolean           res = true;
                string            IdEstadoAproba_Param = "";
                string            IdEstadoAproba       = "";
                in_Parametro_Bus  busParam             = new in_Parametro_Bus();
                in_Parametro_Info infoParam            = new in_Parametro_Info();
                infoParam = busParam.Get_Info_Parametro(info.IdEmpresa);

                if (info.signo == "+")
                {
                    IdEstadoAproba_Param = infoParam.IdEstadoAproba_x_Ing;
                }
                else
                {
                    IdEstadoAproba_Param = infoParam.IdEstadoAproba_x_Egr;
                }

                //Recosteo
                ProcesoRecosteoInventario(info);

                var query = from bod in info.listIng_Egr
                            group bod by bod.IdBodega into grupoBodega
                            orderby grupoBodega.Key
                            select grupoBodega;

                if (query.Count() > 1)
                {
                    // Varias bodegas
                    foreach (var grupoBodega in query)
                    {
                        // Detalle
                        List <in_Ing_Egr_Inven_det_Info> list_IngEgrDet = new List <in_Ing_Egr_Inven_det_Info>();
                        foreach (var bod in grupoBodega)
                        {
                            in_Ing_Egr_Inven_det_Info infoDet = new in_Ing_Egr_Inven_det_Info();

                            //prueba
                            infoDet.IdEmpresa  = bod.IdEmpresa;
                            infoDet.IdSucursal = bod.IdSucursal;
                            infoDet.IdNumMovi  = bod.IdNumMovi;
                            infoDet.Secuencia  = bod.Secuencia;
                            //prueba

                            infoDet.IdBodega       = bod.IdBodega;
                            infoDet.IdProducto     = bod.IdProducto;
                            infoDet.dm_cantidad    = bod.dm_cantidad;
                            infoDet.dm_observacion = bod.dm_observacion;
                            infoDet.mv_costo       = bod.mv_costo;
                            infoDet.IdCentroCosto  = bod.IdCentroCosto;
                            infoDet.IdCentroCosto_sub_centro_costo = bod.IdCentroCosto_sub_centro_costo;
                            infoDet.pr_descripcion      = bod.pr_descripcion;
                            infoDet.IdPunto_cargo       = bod.IdPunto_cargo;
                            infoDet.IdUnidadMedida      = bod.IdUnidadMedida;
                            infoDet.IdPunto_cargo_grupo = bod.IdPunto_cargo_grupo;
                            infoDet.IdMotivo_Inv        = bod.IdMotivo_Inv;

                            if (bod.IdEstadoAproba == null)
                            {
                                infoDet.IdEstadoAproba = Get_EstadoApro(bod.IdEmpresa, bod.IdSucursal, Convert.ToInt32(bod.IdBodega), IdEstadoAproba_Param);
                            }
                            else
                            {
                                infoDet.IdEstadoAproba = bod.IdEstadoAproba;
                            }

                            if (infoDet.IdEstadoAproba == Cl_Enumeradores.eEstadoAprobacion_Ing_Egr.PEND.ToString())
                            {
                                infoDet.Motivo_Aprobacion = null;
                            }
                            else
                            {
                                infoDet.Motivo_Aprobacion = (bod.Motivo_Aprobacion == null) ? "APROBADO POR SISTEMAS" : bod.Motivo_Aprobacion;
                            }

                            infoDet.IdUnidadMedida_sinConversion = bod.IdUnidadMedida_sinConversion;
                            infoDet.mv_costo_sinConversion       = bod.mv_costo_sinConversion;
                            infoDet.dm_cantidad_sinConversion    = bod.dm_cantidad_sinConversion;

                            list_IngEgrDet.Add(infoDet);
                        }
                        //cabecera
                        in_Ing_Egr_Inven_Info info_IngEgr = new in_Ing_Egr_Inven_Info();

                        info_IngEgr.IdEmpresa         = info.IdEmpresa;
                        info_IngEgr.IdNumMovi         = info.IdNumMovi;
                        info_IngEgr.IdSucursal        = info.IdSucursal;
                        info_IngEgr.IdBodega          = info.IdBodega;
                        info_IngEgr.CodMoviInven      = info.CodMoviInven;
                        info_IngEgr.cm_observacion    = info.cm_observacion;
                        info_IngEgr.IdMovi_inven_tipo = info.IdMovi_inven_tipo;
                        info_IngEgr.cm_fecha          = info.cm_fecha;
                        info_IngEgr.IdUsuario         = info.IdUsuario;
                        info_IngEgr.nom_pc            = info.nom_pc;
                        info_IngEgr.ip            = info.ip;
                        info_IngEgr.Fecha_Transac = info.Fecha_Transac;
                        info_IngEgr.signo         = info.signo;
                        info_IngEgr.IdMotivo_Inv  = info.IdMotivo_Inv;
                        info_IngEgr.listIng_Egr   = list_IngEgrDet;//asignando el detalle

                        res = Genera_Inventario(info_IngEgr, ref IdNumMovi, ref mensaje);
                    }
                }
                else
                {
                    IdEstadoAproba = Get_EstadoApro(Convert.ToInt32(info.IdEmpresa), Convert.ToInt32(info.IdSucursal), Convert.ToInt32(info.IdBodega), IdEstadoAproba_Param);
                    foreach (var item in info.listIng_Egr)
                    {
                        if (item.IdEstadoAproba == null)
                        {
                            item.IdEstadoAproba = IdEstadoAproba;
                        }

                        if (item.IdEstadoAproba == Cl_Enumeradores.eEstadoAprobacion_Ing_Egr.PEND.ToString())
                        {
                            item.Motivo_Aprobacion = null;
                        }
                        else
                        {
                            item.Motivo_Aprobacion = (item.Motivo_Aprobacion == null) ? "APROBADO POR SISTEMAS" : item.Motivo_Aprobacion;
                        }
                    }

                    //una bodega
                    res = Genera_Inventario(info, ref IdNumMovi, ref mensaje);
                }
                return(res);
            }
            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("", "procesoGenerarMoviInve", ex.Message), ex)
                      {
                          EntityType = typeof(in_Ing_Egr_Inven_Bus)
                      };
            }
        }
Exemplo n.º 27
0
 public in_Parametro_Info Get_Info_Parametro(int IdEmpresa)
 {
     try
     {
         in_Parametro_Info Cbt = null;
         using (SqlConnection connection = new SqlConnection(ConexionERP.GetConnectionString()))
         {
             connection.Open();
             SqlCommand command = new SqlCommand();
             command.Connection  = connection;
             command.CommandText = "SELECT [IdEmpresa],[IdCentroCosto_Padre_a_cargar],[LabelCentroCosto],[IdMovi_inven_tipo_egresoBodegaOrigen],[IdMovi_inven_tipo_ingresoBodegaDestino],[Maneja_Stock_Negativo],[Usuario_Escoge_Motivo],[IdMovi_inven_tipo_egresoAjuste]"
                                   + " ,[IdMovi_inven_tipo_ingresoAjuste],[Mostrar_CentroCosto_en_transacciones],[Rango_Busqueda_Transacciones],[pa_EstadoInicial_Pedido],[IdCtaCble_Inven],[IdCtaCble_CostoInven],[IdTipoCbte_CostoInven],[IdBodegaSuministro],[IdCentro_Costo_Inventario]"
                                   + " ,[IdCentro_Costo_Costo],[IdTipoCbte_CostoInven_Reverso],[IdMovi_Inven_tipo_x_anu_Ing],[IdMovi_Inven_tipo_x_anu_Egr],[IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa],[IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa],[ApruebaAjusteFisicoAuto],[IdSucursal_Suministro]"
                                   + " ,[IdEstadoAproba_x_Ing],[IdEstadoAproba_x_Egr],[IdMovi_Inven_tipo_x_Dev_Inv_x_Ing],[IdMovi_Inven_tipo_x_Dev_Inv_x_Erg],[P_Grabar_Items_x_Cada_Movi_Inven],[P_Fecha_para_contabilizacion_ingr_egr],[P_se_valida_parametrizacion_x_producto]"
                                   + " ,[P_Al_Conta_CtaInven_Buscar_en],[P_Al_Conta_CtaCosto_Buscar_en],[P_IdCtaCble_transitoria_transf_inven],[IdMovi_inven_tipo_mobile_ing],[IdMovi_inven_tipo_mobile_egr],[P_ValidarDiasHaciaAtras],[IdCtaCble_Provision]"
                                   + " FROM [dbo].[in_parametro]"
                                   + " where IdEmpresa = " + IdEmpresa.ToString();
             SqlDataReader reader = command.ExecuteReader();
             while (reader.Read())
             {
                 Cbt = new in_Parametro_Info
                 {
                     IdCentroCosto_Padre_a_cargar           = reader["IdCentroCosto_Padre_a_cargar"] == DBNull.Value ? null : reader["IdCentroCosto_Padre_a_cargar"].ToString(),
                     LabelCentroCosto                       = reader["LabelCentroCosto"] == DBNull.Value ? null : reader["LabelCentroCosto"].ToString(),
                     IdMovi_inven_tipo_egresoBodegaOrigen   = reader["IdMovi_inven_tipo_egresoBodegaOrigen"] == DBNull.Value ? null : (int?)reader["IdMovi_inven_tipo_egresoBodegaOrigen"],
                     IdMovi_inven_tipo_ingresoBodegaDestino = reader["IdMovi_inven_tipo_ingresoBodegaDestino"] == DBNull.Value ? null : (int?)reader["IdMovi_inven_tipo_ingresoBodegaDestino"],
                     Maneja_Stock_Negativo                  = reader["Maneja_Stock_Negativo"] == DBNull.Value ? null : reader["Maneja_Stock_Negativo"].ToString(),
                     Usuario_Escoge_Motivo                  = reader["Usuario_Escoge_Motivo"] == DBNull.Value ? null : reader["Usuario_Escoge_Motivo"].ToString(),
                     IdMovi_inven_tipo_egresoAjuste         = reader["IdMovi_inven_tipo_egresoAjuste"] == DBNull.Value ? null : (int?)reader["IdMovi_inven_tipo_egresoAjuste"],
                     IdMovi_inven_tipo_ingresoAjuste        = reader["IdMovi_inven_tipo_ingresoAjuste"] == DBNull.Value ? null : (int?)reader["IdMovi_inven_tipo_ingresoAjuste"],
                     Mostrar_CentroCosto_en_transacciones   = reader["Mostrar_CentroCosto_en_transacciones"] == DBNull.Value ? null : reader["Mostrar_CentroCosto_en_transacciones"].ToString(),
                     Rango_Busqueda_Transacciones           = (int)reader["Rango_Busqueda_Transacciones"],
                     ApruebaAjusteFisicoAuto                = reader["ApruebaAjusteFisicoAuto"] == DBNull.Value ? null : reader["ApruebaAjusteFisicoAuto"].ToString(),
                     IdEmpresa                              = Convert.ToInt32(reader["IdEmpresa"]),
                     IdCtaCble_Inven                        = reader["IdCtaCble_Inven"] == DBNull.Value ? null : reader["IdCtaCble_Inven"].ToString(),
                     IdCtaCble_CostoInven                   = reader["IdCtaCble_CostoInven"] == DBNull.Value ? null : reader["IdCtaCble_CostoInven"].ToString(),
                     IdCentro_Costo_Costo                   = reader["IdCentro_Costo_Costo"] == DBNull.Value ? null : reader["IdCentro_Costo_Costo"].ToString(),
                     IdCentro_Costo_Inventario              = reader["IdCentro_Costo_Inventario"] == DBNull.Value ? null : reader["IdCentro_Costo_Inventario"].ToString(),
                     IdTipoCbte_CostoInven                  = reader["IdTipoCbte_CostoInven"] == DBNull.Value ? null : (int?)reader["IdTipoCbte_CostoInven"],
                     IdTipoCbte_CostoInven_Reverso          = reader["IdTipoCbte_CostoInven_Reverso"] == DBNull.Value ? null : (int?)reader["IdTipoCbte_CostoInven_Reverso"],
                     IdMovi_Inven_tipo_x_anu_Egr            = reader["IdMovi_Inven_tipo_x_anu_Egr"] == DBNull.Value ? null : (int?)reader["IdMovi_Inven_tipo_x_anu_Egr"],
                     IdMovi_Inven_tipo_x_anu_Ing            = reader["IdMovi_Inven_tipo_x_anu_Ing"] == DBNull.Value ? null : (int?)reader["IdMovi_Inven_tipo_x_anu_Ing"],
                     IdSucursalSuministro                   = Convert.ToInt32(reader["IdSucursal_Suministro"]),
                     IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = reader["IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa"] == DBNull.Value ? null : (int?)reader["IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa"],
                     IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = reader["IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa"] == DBNull.Value ? null : (int?)reader["IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa"],
                     IdBodegaSuministro                     = Convert.ToInt32(reader["IdBodegaSuministro"]),
                     IdEstadoAproba_x_Ing                   = reader["IdEstadoAproba_x_Ing"] == DBNull.Value ? null : reader["IdEstadoAproba_x_Ing"].ToString(),
                     IdEstadoAproba_x_Egr                   = reader["IdEstadoAproba_x_Egr"] == DBNull.Value ? null : reader["IdEstadoAproba_x_Egr"].ToString(),
                     P_Grabar_Items_x_Cada_Movi_Inven       = reader["P_Grabar_Items_x_Cada_Movi_Inven"] == DBNull.Value ? null : (bool?)reader["P_Grabar_Items_x_Cada_Movi_Inven"],
                     IdMovi_Inven_tipo_x_Dev_Inv_x_Erg      = reader["IdMovi_Inven_tipo_x_Dev_Inv_x_Erg"] == DBNull.Value ? null : (int?)reader["IdMovi_Inven_tipo_x_Dev_Inv_x_Erg"],
                     IdMovi_Inven_tipo_x_Dev_Inv_x_Ing      = reader["IdMovi_Inven_tipo_x_Dev_Inv_x_Ing"] == DBNull.Value ? null : (int?)reader["IdMovi_Inven_tipo_x_Dev_Inv_x_Ing"],
                     P_Fecha_para_contabilizacion_ingr_egr  = reader["P_Fecha_para_contabilizacion_ingr_egr"] == DBNull.Value ? null : reader["P_Fecha_para_contabilizacion_ingr_egr"].ToString(),
                     P_se_valida_parametrizacion_x_producto = reader["P_se_valida_parametrizacion_x_producto"] == DBNull.Value ? null : (bool?)reader["P_se_valida_parametrizacion_x_producto"],
                     P_IdCtaCble_transitoria_transf_inven   = reader["P_IdCtaCble_transitoria_transf_inven"] == DBNull.Value ? null : reader["P_IdCtaCble_transitoria_transf_inven"].ToString(),
                     IdMovi_inven_tipo_mobile_ing           = reader["IdMovi_inven_tipo_mobile_ing"] == DBNull.Value ? null : (int?)reader["IdMovi_inven_tipo_mobile_ing"],
                     IdMovi_inven_tipo_mobile_egr           = reader["IdMovi_inven_tipo_mobile_egr"] == DBNull.Value ? null : (int?)reader["IdMovi_inven_tipo_mobile_egr"],
                     P_ValidarDiasHaciaAtras                = reader["P_ValidarDiasHaciaAtras"] == DBNull.Value ? null : (int?)reader["P_ValidarDiasHaciaAtras"],
                     IdCtaCble_Provision                    = reader["IdCtaCble_Provision"] == DBNull.Value ? null : reader["IdCtaCble_Provision"].ToString()
                 };
             }
             return(Cbt);
         }
     }
     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() + " " + ex.Message;
         throw new Exception(mensaje);
     }
 }
Exemplo n.º 28
0
        private bool grabar_movimientos_x_distribucion()
        {
            try
            {
                info_param_in   = bus_param_in.Get_Info_Parametro(param.IdEmpresa);
                lst_motivo_inve = bus_motivo_inve.Get_List_Motivo_Inven(param.IdEmpresa, "");
                in_Ing_Egr_Inven_distribucion_Info distribucion_sin_lote = bus_distribucion.get_info(info_distribucion.IdEmpresa, info_distribucion.IdSucursal, info_distribucion.IdMovi_inven_tipo, info_distribucion.IdNumMovi, (info_distribucion.signo == "+" ? "-" : "+"));
                in_Ing_Egr_Inven_distribucion_Info distribucion_con_lote = bus_distribucion.get_info(info_distribucion.IdEmpresa, info_distribucion.IdSucursal, info_distribucion.IdMovi_inven_tipo, info_distribucion.IdNumMovi, info_distribucion.signo);
                in_Motivo_Inven_Info info_motivo = new in_Motivo_Inven_Info();
                in_Ing_Egr_Inven_Bus bus_ing_egr = new in_Ing_Egr_Inven_Bus();
                decimal Id      = 0;
                string  mensaje = "";

                #region Crear movimiento sin lote
                in_Ing_Egr_Inven_Info mov_sin_lote = new in_Ing_Egr_Inven_Info();

                #region Cabecera
                if (distribucion_sin_lote != null)
                {
                    mov_sin_lote = bus_ing_egr.Get_Info_Ing_Egr_Inven(distribucion_sin_lote.IdEmpresa_dis, distribucion_sin_lote.IdSucursal_dis, distribucion_sin_lote.IdMovi_inven_tipo_dis, distribucion_sin_lote.IdNumMovi_dis);
                }
                else
                {
                    info_motivo = lst_motivo_inve.FirstOrDefault(q => q.Genera_Movi_Inven == "S" && q.Tipo_Ing_Egr == (info_distribucion.signo == "+" ? ein_Tipo_Ing_Egr.EGR : ein_Tipo_Ing_Egr.ING));
                    if (info_motivo == null)
                    {
                        MessageBox.Show("No existe motivo de inventario parametrizado, por favor corregir", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }

                    mov_sin_lote = new in_Ing_Egr_Inven_Info
                    {
                        IdEmpresa         = param.IdEmpresa,
                        IdSucursal        = info_distribucion.IdSucursal,
                        IdMovi_inven_tipo = info_distribucion.signo == "+" ? Convert.ToInt32(info_param_in.IdMovi_inven_tipo_x_distribucion_egr) : Convert.ToInt32(info_param_in.IdMovi_inven_tipo_x_distribucion_ing),
                        IdNumMovi         = 0,
                        IdBodega          = info_distribucion.IdBodega,
                        signo             = (info_distribucion.signo == "+" ? "-" : "+"),
                        CodMoviInven      = "Dis_" + info_distribucion.IdEmpresa.ToString("00") + "_" + info_distribucion.IdSucursal.ToString("00") + "_" + info_distribucion.IdMovi_inven_tipo.ToString("00") + "_" + info_distribucion.IdNumMovi.ToString("000000000"),
                        cm_observacion    = "Dis. x lote - Sucursal: " + info_distribucion.Su_Descripcion.Trim() + " # Movi: " + info_distribucion.IdNumMovi.ToString("000000000"),
                        cm_fecha          = DateTime.Now.Date,
                        IdUsuario         = param.IdUsuario,
                        Estado            = "A",
                        Fecha_Transac     = DateTime.Now,
                        nom_pc            = param.nom_pc,
                        ip           = param.ip,
                        IdMotivo_Inv = info_motivo.IdMotivo_Inv
                    };
                }
                #endregion

                #region Detalle
                foreach (var item in blst_x_distribuir)
                {
                    if (item.can_distribuida > 0)
                    {
                        in_Ing_Egr_Inven_det_Info info_det = new in_Ing_Egr_Inven_det_Info
                        {
                            IdEmpresa                    = mov_sin_lote.IdEmpresa,
                            IdSucursal                   = mov_sin_lote.IdSucursal,
                            IdMovi_inven_tipo            = mov_sin_lote.IdMovi_inven_tipo,
                            IdNumMovi                    = mov_sin_lote.IdNumMovi,
                            IdBodega                     = mov_sin_lote.IdBodega,
                            IdProducto                   = item.IdProducto,
                            dm_observacion               = "",
                            dm_cantidad                  = item.can_distribuida == null ? 0 : Convert.ToDouble(item.can_distribuida) * (info_distribucion.signo == "+" ? -1 : 1),
                            dm_cantidad_sinConversion    = item.can_distribuida == null ? 0 : Convert.ToDouble(item.can_distribuida),
                            mv_costo                     = item.mv_costo,
                            mv_costo_sinConversion       = item.mv_costo,
                            IdUnidadMedida               = item.IdUnidadMedida,
                            IdUnidadMedida_sinConversion = item.IdUnidadMedida,
                        };
                        mov_sin_lote.listIng_Egr.Add(info_det);
                    }
                }
                #endregion

                #endregion

                #region Crear movimiento con lote
                in_Ing_Egr_Inven_Info mov_con_lote = new in_Ing_Egr_Inven_Info();

                #region Cabecera
                if (distribucion_con_lote != null)
                {
                    mov_con_lote = bus_ing_egr.Get_Info_Ing_Egr_Inven(distribucion_con_lote.IdEmpresa_dis, distribucion_con_lote.IdSucursal_dis, distribucion_con_lote.IdMovi_inven_tipo_dis, distribucion_con_lote.IdNumMovi_dis);
                }
                else
                {
                    info_motivo = lst_motivo_inve.FirstOrDefault(q => q.Genera_Movi_Inven == "S" && q.Tipo_Ing_Egr == (info_distribucion.signo == "+" ? ein_Tipo_Ing_Egr.ING : ein_Tipo_Ing_Egr.EGR));
                    if (info_motivo == null)
                    {
                        MessageBox.Show("No existe motivo de inventario parametrizado, por favor corregir", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(false);
                    }

                    mov_con_lote = new in_Ing_Egr_Inven_Info
                    {
                        IdEmpresa         = param.IdEmpresa,
                        IdSucursal        = info_distribucion.IdSucursal,
                        IdMovi_inven_tipo = info_distribucion.signo == "+" ? Convert.ToInt32(info_param_in.IdMovi_inven_tipo_x_distribucion_ing) : Convert.ToInt32(info_param_in.IdMovi_inven_tipo_x_distribucion_egr),
                        IdNumMovi         = 0,
                        IdBodega          = info_distribucion.IdBodega,
                        signo             = info_distribucion.signo,
                        CodMoviInven      = "Dis_" + info_distribucion.IdEmpresa.ToString("00") + "_" + info_distribucion.IdSucursal.ToString("00") + "_" + info_distribucion.IdMovi_inven_tipo.ToString("00") + "_" + info_distribucion.IdNumMovi.ToString("000000000"),
                        cm_observacion    = "Dis. x lote - Sucursal: " + info_distribucion.Su_Descripcion.Trim() + " # Movi: " + info_distribucion.IdNumMovi.ToString("000000000"),
                        cm_fecha          = DateTime.Now.Date,
                        IdUsuario         = param.IdUsuario,
                        Estado            = "A",
                        Fecha_Transac     = DateTime.Now,
                        nom_pc            = param.nom_pc,
                        ip           = param.ip,
                        IdMotivo_Inv = info_motivo.IdMotivo_Inv
                    };
                }
                #endregion

                #region Detalle
                foreach (var item in blst_distribuido)
                {
                    in_Ing_Egr_Inven_det_Info info_det = new in_Ing_Egr_Inven_det_Info
                    {
                        IdEmpresa                    = mov_sin_lote.IdEmpresa,
                        IdSucursal                   = mov_sin_lote.IdSucursal,
                        IdMovi_inven_tipo            = mov_sin_lote.IdMovi_inven_tipo,
                        IdNumMovi                    = mov_sin_lote.IdNumMovi,
                        IdBodega                     = mov_sin_lote.IdBodega,
                        IdProducto                   = item.IdProducto,
                        dm_observacion               = "",
                        dm_cantidad                  = item.dm_cantidad == null ? 0 : Convert.ToDouble(item.dm_cantidad) * (info_distribucion.signo == "+" ? 1 : -1),
                        dm_cantidad_sinConversion    = item.dm_cantidad == null ? 0 : Convert.ToDouble(item.dm_cantidad),
                        mv_costo                     = item.mv_costo,
                        mv_costo_sinConversion       = item.mv_costo,
                        IdUnidadMedida               = item.IdUnidadMedida,
                        IdUnidadMedida_sinConversion = item.IdUnidadMedida,
                    };
                    mov_con_lote.listIng_Egr.Add(info_det);
                }
                #endregion

                #endregion

                #region guardar movimientos y distribucion
                if (distribucion_sin_lote == null)
                {
                    if (!bus_ing_egr.GuardarDB(mov_sin_lote, ref Id, ref mensaje))
                    {
                        return(false);
                    }

                    distribucion_sin_lote = new in_Ing_Egr_Inven_distribucion_Info
                    {
                        IdEmpresa         = info_distribucion.IdEmpresa,
                        IdSucursal        = info_distribucion.IdSucursal,
                        IdMovi_inven_tipo = info_distribucion.IdMovi_inven_tipo,
                        IdNumMovi         = info_distribucion.IdNumMovi,

                        IdEmpresa_dis         = mov_sin_lote.IdEmpresa,
                        IdSucursal_dis        = mov_sin_lote.IdSucursal,
                        IdMovi_inven_tipo_dis = mov_sin_lote.IdMovi_inven_tipo,
                        IdNumMovi_dis         = mov_sin_lote.IdNumMovi,
                        signo  = mov_sin_lote.signo,
                        estado = true,
                    };

                    if (!bus_distribucion.guardarDB(distribucion_sin_lote))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!bus_ing_egr.Reversar_Aprobacion(distribucion_sin_lote.IdEmpresa_dis, distribucion_sin_lote.IdSucursal_dis, distribucion_sin_lote.IdMovi_inven_tipo_dis, distribucion_sin_lote.IdNumMovi_dis, "S"))
                    {
                        return(false);
                    }

                    if (!bus_ing_egr.ModificarDB(mov_sin_lote, ref mensaje))
                    {
                        return(false);
                    }
                }

                if (distribucion_con_lote == null)
                {
                    if (!bus_ing_egr.GuardarDB(mov_con_lote, ref Id, ref mensaje))
                    {
                        return(false);
                    }

                    distribucion_con_lote = new in_Ing_Egr_Inven_distribucion_Info
                    {
                        IdEmpresa         = info_distribucion.IdEmpresa,
                        IdSucursal        = info_distribucion.IdSucursal,
                        IdMovi_inven_tipo = info_distribucion.IdMovi_inven_tipo,
                        IdNumMovi         = info_distribucion.IdNumMovi,

                        IdEmpresa_dis         = mov_con_lote.IdEmpresa,
                        IdSucursal_dis        = mov_con_lote.IdSucursal,
                        IdMovi_inven_tipo_dis = mov_con_lote.IdMovi_inven_tipo,
                        IdNumMovi_dis         = mov_con_lote.IdNumMovi,
                        signo  = mov_con_lote.signo,
                        estado = true,
                    };

                    if (!bus_distribucion.guardarDB(distribucion_con_lote))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!bus_ing_egr.Reversar_Aprobacion(distribucion_con_lote.IdEmpresa_dis, distribucion_con_lote.IdSucursal_dis, distribucion_con_lote.IdMovi_inven_tipo_dis, distribucion_con_lote.IdNumMovi_dis, "S"))
                    {
                        return(false);
                    }

                    if (!bus_ing_egr.ModificarDB(mov_con_lote, ref mensaje))
                    {
                        return(false);
                    }
                }
                #endregion

                return(true);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 29
0
        public Boolean ModificarDB(in_Parametro_Info info, int IdEmpresa)
        {
            try
            {
                using (EntitiesInventario context = new EntitiesInventario())
                {
                    EntitiesInventario param_Info = new EntitiesInventario();
                    var selectBaParam             = (from C in param_Info.in_parametro
                                                     where C.IdEmpresa == IdEmpresa
                                                     select C).Count();
                    if (selectBaParam == 0)
                    {
                        var addressG = new in_parametro();
                        addressG.IdEmpresa = IdEmpresa;
                        addressG.IdMovi_inven_tipo_egresoBodegaOrigen   = info.IdMovi_inven_tipo_egresoBodegaOrigen;
                        addressG.IdMovi_inven_tipo_ingresoBodegaDestino = info.IdMovi_inven_tipo_ingresoBodegaDestino;
                        addressG.Maneja_Stock_Negativo           = info.Maneja_Stock_Negativo;
                        addressG.Usuario_Escoge_Motivo           = info.Usuario_Escoge_Motivo;
                        addressG.IdMovi_inven_tipo_egresoAjuste  = info.IdMovi_inven_tipo_egresoAjuste;
                        addressG.IdMovi_inven_tipo_ingresoAjuste = info.IdMovi_inven_tipo_ingresoAjuste;
                        addressG.ApruebaAjusteFisicoAuto         = info.ApruebaAjusteFisicoAuto;


                        addressG.IdCtaCble_Inven      = (info.IdCtaCble_Inven == "") ? null : info.IdCtaCble_Inven;
                        addressG.IdCtaCble_CostoInven = (info.IdCtaCble_CostoInven == "") ? null : info.IdCtaCble_CostoInven;

                        if (info.IdTipoCbte_CostoInven != 0)
                        {
                            addressG.IdTipoCbte_CostoInven = info.IdTipoCbte_CostoInven;
                        }
                        if (info.IdTipoCbte_CostoInven_Reverso != 0)
                        {
                            addressG.IdTipoCbte_CostoInven_Reverso = info.IdTipoCbte_CostoInven_Reverso;
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Ing != 0)
                        {
                            addressG.IdMovi_Inven_tipo_x_anu_Ing = (info.IdMovi_Inven_tipo_x_anu_Ing);
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Egr != 0)
                        {
                            addressG.IdMovi_Inven_tipo_x_anu_Egr = (info.IdMovi_Inven_tipo_x_anu_Egr);
                        }

                        if (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa != 0)
                        {
                            addressG.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa);
                        }
                        if (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa != 0)
                        {
                            addressG.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa);
                        }

                        addressG.IdEstadoAproba_x_Ing = info.IdEstadoAproba_x_Ing;
                        addressG.IdEstadoAproba_x_Egr = info.IdEstadoAproba_x_Egr;

                        addressG.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg                 = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg;
                        addressG.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing                 = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing;
                        addressG.P_Fecha_para_contabilizacion_ingr_egr             = info.P_Fecha_para_contabilizacion_ingr_egr;
                        addressG.P_se_valida_parametrizacion_x_producto            = (info.P_se_valida_parametrizacion_x_producto == null) ? false : Convert.ToBoolean(info.P_se_valida_parametrizacion_x_producto);
                        addressG.P_IdProductoTipo_para_lote_0                      = info.P_IdProductoTipo_para_lote_0;
                        addressG.P_se_crea_lote_0_al_crear_producto_matriz         = info.P_se_crea_lote_0_al_crear_producto_matriz;
                        addressG.P_IdCtaCble_transitoria_transf_inven              = (info.P_IdCtaCble_transitoria_transf_inven == null) ? null : Convert.ToString(info.P_IdCtaCble_transitoria_transf_inven);
                        addressG.IdMovi_inven_tipo_x_distribucion_egr              = info.IdMovi_inven_tipo_x_distribucion_egr;
                        addressG.IdMovi_inven_tipo_x_distribucion_ing              = info.IdMovi_inven_tipo_x_distribucion_ing;
                        addressG.P_IdMovi_inven_tipo_default_egr                   = info.P_IdMovi_inven_tipo_default_egr;
                        addressG.P_IdMovi_inven_tipo_default_ing                   = info.P_IdMovi_inven_tipo_default_ing;
                        addressG.P_IdMovi_inven_tipo_ingreso_x_compra              = info.P_IdMovi_inven_tipo_ingreso_x_compra;
                        addressG.P_Dias_menores_alerta_desde_fecha_actual_amarillo = info.P_Dias_menores_alerta_desde_fecha_actual_amarillo;
                        addressG.P_Dias_menores_alerta_desde_fecha_actual_rojo     = info.P_Dias_menores_alerta_desde_fecha_actual_rojo;
                        context.in_parametro.Add(addressG);
                        context.SaveChanges();
                    }
                    else
                    {
                        var contact = context.in_parametro.First(para => para.IdEmpresa == IdEmpresa);
                        contact.IdEmpresa = IdEmpresa;
                        contact.IdMovi_inven_tipo_egresoBodegaOrigen   = info.IdMovi_inven_tipo_egresoBodegaOrigen;
                        contact.IdMovi_inven_tipo_ingresoBodegaDestino = info.IdMovi_inven_tipo_ingresoBodegaDestino;
                        contact.Maneja_Stock_Negativo           = info.Maneja_Stock_Negativo;
                        contact.Usuario_Escoge_Motivo           = info.Usuario_Escoge_Motivo;
                        contact.IdMovi_inven_tipo_egresoAjuste  = info.IdMovi_inven_tipo_egresoAjuste;
                        contact.IdMovi_inven_tipo_ingresoAjuste = info.IdMovi_inven_tipo_ingresoAjuste;
                        contact.ApruebaAjusteFisicoAuto         = info.ApruebaAjusteFisicoAuto;

                        contact.IdCtaCble_Inven      = info.IdCtaCble_Inven;
                        contact.IdCtaCble_CostoInven = info.IdCtaCble_CostoInven;
                        contact.IdEstadoAproba_x_Ing = info.IdEstadoAproba_x_Ing;
                        contact.IdEstadoAproba_x_Egr = info.IdEstadoAproba_x_Egr;

                        if (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa != 0)
                        {
                            contact.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa);
                        }
                        if (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa != 0)
                        {
                            contact.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa = (info.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa);
                        }

                        if (info.IdTipoCbte_CostoInven != 0)
                        {
                            contact.IdTipoCbte_CostoInven = info.IdTipoCbte_CostoInven;
                        }
                        if (info.IdTipoCbte_CostoInven_Reverso != 0)
                        {
                            contact.IdTipoCbte_CostoInven_Reverso = info.IdTipoCbte_CostoInven_Reverso;
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Ing != 0)
                        {
                            contact.IdMovi_Inven_tipo_x_anu_Ing = (info.IdMovi_Inven_tipo_x_anu_Ing);
                        }
                        if (info.IdMovi_Inven_tipo_x_anu_Egr != 0)
                        {
                            contact.IdMovi_Inven_tipo_x_anu_Egr = (info.IdMovi_Inven_tipo_x_anu_Egr);
                        }
                        contact.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg                 = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg;
                        contact.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing                 = info.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing;
                        contact.P_Fecha_para_contabilizacion_ingr_egr             = info.P_Fecha_para_contabilizacion_ingr_egr;
                        contact.P_se_valida_parametrizacion_x_producto            = (info.P_se_valida_parametrizacion_x_producto == null) ? false : Convert.ToBoolean(info.P_se_valida_parametrizacion_x_producto);
                        contact.P_IdProductoTipo_para_lote_0                      = info.P_IdProductoTipo_para_lote_0;
                        contact.P_se_crea_lote_0_al_crear_producto_matriz         = info.P_se_crea_lote_0_al_crear_producto_matriz;
                        contact.IdMovi_inven_tipo_x_distribucion_ing              = info.IdMovi_inven_tipo_x_distribucion_ing;
                        contact.IdMovi_inven_tipo_x_distribucion_egr              = info.IdMovi_inven_tipo_x_distribucion_egr;
                        contact.P_IdCtaCble_transitoria_transf_inven              = (info.P_IdCtaCble_transitoria_transf_inven == null) ? null : Convert.ToString(info.P_IdCtaCble_transitoria_transf_inven);
                        contact.P_IdMovi_inven_tipo_default_egr                   = info.P_IdMovi_inven_tipo_default_egr;
                        contact.P_IdMovi_inven_tipo_default_ing                   = info.P_IdMovi_inven_tipo_default_ing;
                        contact.P_IdMovi_inven_tipo_ingreso_x_compra              = info.P_IdMovi_inven_tipo_ingreso_x_compra;
                        contact.P_Dias_menores_alerta_desde_fecha_actual_amarillo = info.P_Dias_menores_alerta_desde_fecha_actual_amarillo;
                        contact.P_Dias_menores_alerta_desde_fecha_actual_rojo     = info.P_Dias_menores_alerta_desde_fecha_actual_rojo;
                        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() + " " + ex.Message;
                throw new Exception(mensaje);
            }
        }
Exemplo n.º 30
0
        public in_Parametro_Info Get_Info_Parametro(int IdEmpresa)
        {
            try
            {
                in_Parametro_Info  Cbt        = null;
                EntitiesInventario param_Info = new EntitiesInventario();
                var selectBaParam             = from C in param_Info.in_parametro
                                                where C.IdEmpresa == IdEmpresa
                                                select C;
                foreach (var item in selectBaParam)
                {
                    Cbt = new in_Parametro_Info();

                    Cbt.IdMovi_inven_tipo_egresoBodegaOrigen   = Convert.ToInt32(item.IdMovi_inven_tipo_egresoBodegaOrigen);
                    Cbt.IdMovi_inven_tipo_ingresoBodegaDestino = Convert.ToInt32(item.IdMovi_inven_tipo_ingresoBodegaDestino);
                    Cbt.Maneja_Stock_Negativo           = item.Maneja_Stock_Negativo;
                    Cbt.Usuario_Escoge_Motivo           = item.Usuario_Escoge_Motivo;
                    Cbt.IdMovi_inven_tipo_egresoAjuste  = Convert.ToInt32(item.IdMovi_inven_tipo_egresoAjuste);
                    Cbt.IdMovi_inven_tipo_ingresoAjuste = Convert.ToInt32(item.IdMovi_inven_tipo_ingresoAjuste);
                    Cbt.ApruebaAjusteFisicoAuto         = item.ApruebaAjusteFisicoAuto;
                    Cbt.IdEmpresa                                         = IdEmpresa;
                    Cbt.IdCtaCble_Inven                                   = item.IdCtaCble_Inven;
                    Cbt.IdCtaCble_CostoInven                              = item.IdCtaCble_CostoInven;
                    Cbt.IdTipoCbte_CostoInven                             = item.IdTipoCbte_CostoInven;
                    Cbt.IdTipoCbte_CostoInven_Reverso                     = item.IdTipoCbte_CostoInven_Reverso;
                    Cbt.IdMovi_Inven_tipo_x_anu_Egr                       = item.IdMovi_Inven_tipo_x_anu_Egr;
                    Cbt.IdMovi_Inven_tipo_x_anu_Ing                       = item.IdMovi_Inven_tipo_x_anu_Ing;
                    Cbt.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa            = item.IdMovi_Inven_tipo_Egr_Ajust_fis_x_defa;
                    Cbt.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa            = item.IdMovi_Inven_tipo_Ing_Ajust_fis_x_defa;
                    Cbt.IdTipoCbte_CostoInven                             = item.IdTipoCbte_CostoInven;
                    Cbt.IdTipoCbte_CostoInven_Reverso                     = item.IdTipoCbte_CostoInven_Reverso;
                    Cbt.IdMovi_Inven_tipo_x_anu_Ing                       = (item.IdMovi_Inven_tipo_x_anu_Ing);
                    Cbt.IdMovi_Inven_tipo_x_anu_Egr                       = (item.IdMovi_Inven_tipo_x_anu_Egr);
                    Cbt.IdEstadoAproba_x_Ing                              = item.IdEstadoAproba_x_Ing;
                    Cbt.IdEstadoAproba_x_Egr                              = item.IdEstadoAproba_x_Egr;
                    Cbt.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg                 = item.IdMovi_Inven_tipo_x_Dev_Inv_x_Erg;
                    Cbt.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing                 = item.IdMovi_Inven_tipo_x_Dev_Inv_x_Ing;
                    Cbt.P_Fecha_para_contabilizacion_ingr_egr             = item.P_Fecha_para_contabilizacion_ingr_egr;
                    Cbt.P_se_valida_parametrizacion_x_producto            = item.P_se_valida_parametrizacion_x_producto;
                    Cbt.P_IdCtaCble_transitoria_transf_inven              = item.P_IdCtaCble_transitoria_transf_inven;
                    Cbt.P_IdProductoTipo_para_lote_0                      = item.P_IdProductoTipo_para_lote_0;
                    Cbt.P_se_crea_lote_0_al_crear_producto_matriz         = item.P_se_crea_lote_0_al_crear_producto_matriz;
                    Cbt.IdMovi_inven_tipo_x_distribucion_ing              = item.IdMovi_inven_tipo_x_distribucion_ing;
                    Cbt.IdMovi_inven_tipo_x_distribucion_egr              = item.IdMovi_inven_tipo_x_distribucion_egr;
                    Cbt.P_IdMovi_inven_tipo_default_egr                   = item.P_IdMovi_inven_tipo_default_egr;
                    Cbt.P_IdMovi_inven_tipo_default_ing                   = item.P_IdMovi_inven_tipo_default_ing;
                    Cbt.P_IdMovi_inven_tipo_ingreso_x_compra              = item.P_IdMovi_inven_tipo_ingreso_x_compra;
                    Cbt.P_Dias_menores_alerta_desde_fecha_actual_rojo     = item.P_Dias_menores_alerta_desde_fecha_actual_rojo;
                    Cbt.P_Dias_menores_alerta_desde_fecha_actual_amarillo = item.P_Dias_menores_alerta_desde_fecha_actual_amarillo;
                }
                return(Cbt);
            }
            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() + " " + ex.Message;
                throw new Exception(mensaje);
            }
        }