コード例 #1
0
 public Boolean ModificarDB(cp_Aprobacion_Ing_Bod_x_OC_Info info, ref string msg)
 {
     try
     {
         Boolean res = false;
         using (EntitiesCuentasxPagar context = new EntitiesCuentasxPagar())
         {
             var contact = context.cp_Aprobacion_Ing_Bod_x_OC.FirstOrDefault(minfo => minfo.IdEmpresa == info.IdEmpresa && minfo.IdAprobacion == info.IdAprobacion);
             if (contact != null)
             {
                 contact.IdEmpresa_Ogiro  = info.IdEmpresa_Ogiro;
                 contact.IdCbteCble_Ogiro = info.IdCbteCble_Ogiro;
                 contact.IdTipoCbte_Ogiro = info.IdTipoCbte_Ogiro;
                 context.SaveChanges();
                 res = true;
             }
         }
         return(res);
     }
     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;
         msg     = mensaje;
         throw new Exception(ex.ToString());
     }
 }
コード例 #2
0
        private void preparar_formulario(Cl_Enumeradores.eTipo_action _Accion)
        {
            try
            {
                frmCP_Aprobacion_Ing_Bod_x_OC_Mant frm = new frmCP_Aprobacion_Ing_Bod_x_OC_Mant();
                Info = (cp_Aprobacion_Ing_Bod_x_OC_Info)gridViewConsulta.GetFocusedRow();

                if (_Accion == Cl_Enumeradores.eTipo_action.consultar)
                {
                    if (Info != null)
                    {
                        frm.Text = frm.Text + "***CONSULTAR REGISTRO***";
                    }
                    else
                    {
                        MessageBox.Show("Seleccione un Registro a Consultar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                    }
                }

                if (_Accion == Cl_Enumeradores.eTipo_action.Anular)
                {
                    if (Info != null)
                    {
                        frm.Text = frm.Text + "***ELIMINAR REGISTRO***";
                    }
                    else
                    {
                        MessageBox.Show("Seleccione un Registro a Consultar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return;
                    }
                }

                switch (_Accion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:
                    break;

                case Cl_Enumeradores.eTipo_action.consultar:
                    frm._SetInfo = Info;
                    break;

                case Cl_Enumeradores.eTipo_action.Anular:
                    frm._SetInfo = Info;
                    break;
                }

                frm.set_Accion(_Accion);
                frm.MdiParent = this.MdiParent;
                frm.event_frmCP_Aprobacion_Ing_Bod_x_OC_Mant_FormClosing += frm_event_frmCP_Aprobacion_Ing_Bod_x_OC_Mant_FormClosing;
                frm.Show();
            }
            catch (Exception ex)
            {
                Log_Error_bus = new tb_sis_Log_Error_Vzen_Bus();
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
        public cp_Aprobacion_Ing_Bod_x_OC_Info Get_Info_Aprobacion_Ing_Bod_x_OC(int IdEmpresa, int IdTipoCbte_OG, decimal IdCbteCble_OG)
        {
            cp_Aprobacion_Ing_Bod_x_OC_Info info = new cp_Aprobacion_Ing_Bod_x_OC_Info();
            EntitiesCuentasxPagar           CxP  = new EntitiesCuentasxPagar();

            try
            {
                var Select = from q in CxP.cp_Aprobacion_Ing_Bod_x_OC
                             where q.IdEmpresa == IdEmpresa &&
                             q.IdTipoCbte_Ogiro == IdTipoCbte_OG &&
                             q.IdCbteCble_Ogiro == IdCbteCble_OG
                             select q;

                foreach (var item in Select)
                {
                    info.IdEmpresa        = item.IdEmpresa;
                    info.IdAprobacion     = item.IdAprobacion;
                    info.Fecha_Factura    = item.Fecha_Factura;
                    info.Fecha_aprobacion = item.Fecha_aprobacion;
                    info.IdEmpresa_Ogiro  = item.IdEmpresa_Ogiro;
                    info.IdCbteCble_Ogiro = item.IdCbteCble_Ogiro;
                    info.IdTipoCbte_Ogiro = item.IdTipoCbte_Ogiro;

                    info.IdOrden_giro_Tipo = item.IdOrden_giro_Tipo;
                    info.IdIden_credito    = item.IdIden_credito;

                    info.IdProveedor = item.IdProveedor;
                    info.Observacion = item.Observacion;
                    info.Serie       = item.Serie;

                    info.Serie2 = item.Serie2;

                    info.num_documento            = item.num_documento;
                    info.num_auto_Proveedor       = item.num_auto_Proveedor;
                    info.num_auto_Imprenta        = item.num_auto_Imprenta;
                    info.co_subtotal_iva          = item.co_subtotal_iva;
                    info.co_subtotal_siniva       = item.co_subtotal_siniva;
                    info.Descuento                = item.Descuento;
                    info.co_baseImponible         = item.co_baseImponible;
                    info.co_Por_iva               = item.co_Por_iva;
                    info.co_valoriva              = item.co_valoriva;
                    info.co_total                 = item.co_total;
                    info.co_FechaVctoAutorizacion = item.co_FechaVctoAutorizacion;
                }
                return(info);
            }
            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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #4
0
 public void set_info(cp_Aprobacion_Ing_Bod_x_OC_Info _info)
 {
     try
     {
         info_aprobacion = _info;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #5
0
        private cp_Aprobacion_Ing_Bod_x_OC_Info get_Aprobacion_Ing()
        {
            try
            {
                cp_Aprobacion_Ing_Bod_x_OC_Info Info_Ing_x_OC = new cp_Aprobacion_Ing_Bod_x_OC_Info();
                Info_Ing_x_OC.IdEmpresa        = param.IdEmpresa;
                Info_Ing_x_OC.IdAprobacion     = 0;
                Info_Ing_x_OC.Fecha_aprobacion = Convert.ToDateTime(dtpFechaConciliacion.Value);
                Info_Ing_x_OC.IdProveedor      = cmbProveedor.get_ProveedorInfo().IdProveedor;

                foreach (var item in lstPendiFact)
                {
                    if (item.Checked == true)
                    {
                        Info_Ing_x_OC.Fecha_Factura      = item.co_FechaFactura;
                        Info_Ing_x_OC.IdEmpresa_Ogiro    = item.IdEmpresa;
                        Info_Ing_x_OC.IdCbteCble_Ogiro   = item.IdCbteCble_Ogiro;
                        Info_Ing_x_OC.IdTipoCbte_Ogiro   = item.IdTipoCbte_Ogiro;
                        Info_Ing_x_OC.IdOrden_giro_Tipo  = item.IdOrden_giro_Tipo;
                        Info_Ing_x_OC.IdIden_credito     = item.IdIden_credito;
                        Info_Ing_x_OC.Observacion        = item.co_observacion;
                        Info_Ing_x_OC.Serie              = item.Serie;
                        Info_Ing_x_OC.Serie2             = item.Serie2;
                        Info_Ing_x_OC.num_documento      = item.numDocFactura;
                        Info_Ing_x_OC.num_auto_Proveedor = (item.Num_Autorizacion == null || item.Num_Autorizacion == "") ? " " : item.Num_Autorizacion;
                        Info_Ing_x_OC.num_auto_Imprenta  = (item.Num_Autorizacion_Imprenta == null || item.Num_Autorizacion_Imprenta == "") ? " " : item.Num_Autorizacion_Imprenta;
                        Info_Ing_x_OC.co_subtotal_iva    = item.co_subtotal_iva;
                        Info_Ing_x_OC.co_subtotal_siniva = item.co_subtotal_siniva;
                        Info_Ing_x_OC.Descuento          = item.co_OtroValor_a_descontar;
                        Info_Ing_x_OC.co_baseImponible   = item.co_baseImponible;
                        Info_Ing_x_OC.co_Por_iva         = item.co_Por_iva;
                        Info_Ing_x_OC.co_valoriva        = item.co_valoriva;
                        Info_Ing_x_OC.co_total           = item.co_total;
                        Info_Ing_x_OC.fecha_autorizacion = item.fecha_autorizacion;
                        Info_Ing_x_OC.IdCtaCble_CXP      = cmbProveedor.get_ProveedorInfo().IdCtaCble_CXP;
                        Info_Ing_x_OC.IdCtaCble_Gasto    = item.IdCtaCble_Gasto;
                        Info_Ing_x_OC.pa_ctacble_iva     = item.IdCtaCble_IVA;
                    }
                }

                Info_Ing_x_OC.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
                Info_Ing_x_OC.listDetalle = GetDetalle(Info_Ing_x_OC.IdCtaCble_Gasto, Info_Ing_x_OC.pa_ctacble_iva);

                return(Info_Ing_x_OC);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(new cp_Aprobacion_Ing_Bod_x_OC_Info());
            }
        }
コード例 #6
0
        private void get_info()
        {
            try
            {
                info_cp_param                           = bus_cp_param.Get_Info_parametros(param.IdEmpresa);
                info_aprobacion                         = new cp_Aprobacion_Ing_Bod_x_OC_Info();
                info_aprobacion.IdEmpresa               = param.IdEmpresa;
                info_aprobacion.IdAprobacion            = Convert.ToDecimal((txtIdAprobacion.EditValue == "") ? 0 : Convert.ToDecimal(txtIdAprobacion.EditValue));
                info_aprobacion.Fecha_Factura           = Convert.ToDateTime(dtpFecFactura.EditValue);
                info_aprobacion.Fecha_aprobacion        = Convert.ToDateTime(de_fecha.EditValue);
                info_aprobacion.co_FechaContabilizacion = Convert.ToDateTime(Convert.ToDateTime(dtp_fecha_contabilizacion.EditValue).ToShortDateString());
                info_aprobacion.Fecha_vcto              = Convert.ToDateTime(dtpFecVtc.EditValue);
                info_aprobacion.co_plazo                = Convert.ToInt32(txt_plazo.Text);



                info_aprobacion.IdOrden_giro_Tipo  = Convert.ToString(cmbTipoDocu.EditValue).Trim();
                info_aprobacion.IdIden_credito     = Convert.ToInt32(cmbSustTrib.EditValue);
                info_aprobacion.IdProveedor        = ucCp_Proveedor1.get_ProveedorInfo().IdProveedor;
                info_aprobacion.Observacion        = Convert.ToString(txtObservacion.EditValue).Trim() + "FP:#" + txtSerie.Text + "-" + txtSerie2.Text + "-" + txtNumDocu.Text + " Prv:" + ucCp_Proveedor1.get_ProveedorInfo().pr_nombre;
                info_aprobacion.Serie              = Convert.ToString(txtSerie.EditValue).Trim();
                info_aprobacion.Serie2             = Convert.ToString(txtSerie2.EditValue).Trim();
                info_aprobacion.num_documento      = Convert.ToString(txtNumDocu.EditValue).Trim();
                info_aprobacion.num_auto_Proveedor = Convert.ToString(txtNumAutProve.EditValue).Trim();
                info_aprobacion.num_auto_Imprenta  = "";
                info_aprobacion.co_subtotal_iva    = Math.Round((txtSubtotalIva.EditValue == "" ? 0 : Convert.ToDouble(txtSubtotalIva.EditValue)), 2);
                info_aprobacion.co_subtotal_siniva = Math.Round((txtSubtotal0.EditValue == "" ? 0 : Convert.ToDouble(txtSubtotal0.EditValue)), 2);
                info_aprobacion.Descuento          = Math.Round((txtTotDescuento.EditValue == "" ? 0 : Convert.ToDouble(txtTotDescuento.EditValue)), 2);
                info_aprobacion.co_baseImponible   = Math.Round((txtSubtotal.EditValue == "" ? 0 : Convert.ToDouble(txtSubtotal.EditValue)), 2);
                double por_iva = param.iva.porcentaje;
                //if (blst_det.Where(q => q.Checked == true).Count() != 0)
                por_iva = blst_det.Max(q => q.PorIva);
                info_aprobacion.co_Por_iva = por_iva;


                info_aprobacion.co_valoriva        = Math.Round((txtTotalIva.EditValue == "" ? 0 : Convert.ToDouble(txtTotalIva.EditValue)), 2);
                info_aprobacion.co_total           = Math.Round((txtTotal.EditValue == "" ? 0 : Convert.ToDouble(txtTotal.EditValue)), 2);
                info_aprobacion.IdCtaCble_CXP      = ucCp_Proveedor1.get_ProveedorInfo().IdCtaCble_CXP;
                info_aprobacion.pa_ctacble_iva     = info_cp_param.pa_ctacble_iva;
                info_aprobacion.IdCentroCosoto_CXP = null;

                info_aprobacion.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>(blst_det);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
 public Boolean ModificarDB(cp_Aprobacion_Ing_Bod_x_OC_Info info, ref string msg)
 {
     try
     {
         return(odata.ModificarDB(info, ref msg));
     }
     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(cp_Aprobacion_Ing_Bod_x_OC_Bus)
               };
     }
 }
コード例 #8
0
        public Boolean EliminarDB(int IdEmpresa, decimal IdAprobacion, string IdUsuario, string MotivoAnula, ref string msg)
        {
            try
            {
                #region Guaarda las aprobaciones eliminadas en otra tabla
                //para extraer los datos antes de eliminar
                cp_Aprobacion_Ing_Bod_x_OC_Info            info             = new cp_Aprobacion_Ing_Bod_x_OC_Info();
                cp_Aprobacion_Ing_Bod_x_OC_Bus             Bus_Info         = new cp_Aprobacion_Ing_Bod_x_OC_Bus();
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lista_Info       = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
                cp_Aprobacion_Ing_Bod_x_OC_det_Bus         Bus_info_detalle = new cp_Aprobacion_Ing_Bod_x_OC_det_Bus();

                info             = Bus_Info.Get_Info_Aprobacion_Ing_Bod_x_OC(IdEmpresa, IdAprobacion);
                info.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();

                Lista_Info       = Bus_info_detalle.Get_List_Aprobacion_Ing_Bod_x_OC_det(IdEmpresa, IdAprobacion);
                info.listDetalle = Lista_Info;


                bool respuesta = false;



                #endregion

                if (respuesta)
                {
                    respuesta = odata.EliminarDB(info.IdEmpresa, info.IdAprobacion, ref msg);
                }
                else
                {
                    msg       = "No se pudo eliminar la aprobación seleccionada, favor comuniquese con sistemas";
                    respuesta = false;
                }
                return(respuesta);
            }
            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(cp_Aprobacion_Ing_Bod_x_OC_Bus)
                      };
            }
        }
コード例 #9
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();
 }
コード例 #10
0
        public Boolean AnularFacturaProveedor(cp_orden_giro_Info ordenGiro_I,
                                              List <cp_orden_giro_x_com_ordencompra_local_Info> LstImportacionOC, ref decimal IdCbteCbleRev, ref string msg2)
        {
            Boolean res = true;

            try
            {
                if (CbteCble_B.ReversoCbteCble(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, ordenGiro_I.IdTipoCbte_Ogiro,
                                               Convert.ToInt32(ordenGiro_I.IdTipoCbte_Anulacion), ref IdCbteCbleRev, ref msg2, ordenGiro_I.IdUsuarioUltAnu))
                {
                    ordenGiro_I.IdCbteCble_Anulacion = IdCbteCbleRev;
                    if (data.EliminarDB(ordenGiro_I, ref msg2))
                    {
                        #region Anula Retención
                        decimal           idrev          = 0;
                        cp_retencion_Info Info_retencion = Bus_Retencion.Get_Info_retencion(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, ordenGiro_I.IdTipoCbte_Ogiro);

                        //cp_retencion_x_ct_cbtecble_Info ret_x_dia = ret_B.ObtenerObjetoRetXCbteCble(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro,
                        //    ordenGiro_I.IdTipoCbte_Ogiro);

                        if (Info_retencion.IdRetencion != 0)
                        {
                            if (!Bus_Retencion.AnularDB(Info_retencion, ref idrev, ref msg2))
                            {
                                return(false);
                            }
                        }
                        #endregion

                        #region Eliminar Aprobación de ing a bodega x OC

                        cp_Aprobacion_Ing_Bod_x_OC_Bus  bus_aprob_ing_bod_x_OC  = new cp_Aprobacion_Ing_Bod_x_OC_Bus();
                        cp_Aprobacion_Ing_Bod_x_OC_Info info_aprob_ing_bod_x_OC = new cp_Aprobacion_Ing_Bod_x_OC_Info();

                        info_aprob_ing_bod_x_OC = bus_aprob_ing_bod_x_OC.Get_Info_Aprobacion_Ing_Bod_x_OC(ordenGiro_I.IdEmpresa, ordenGiro_I.IdTipoCbte_Ogiro, ordenGiro_I.IdCbteCble_Ogiro);
                        if (info_aprob_ing_bod_x_OC.IdAprobacion != 0)
                        {
                            bus_aprob_ing_bod_x_OC.EliminarDB(info_aprob_ing_bod_x_OC.IdEmpresa, info_aprob_ing_bod_x_OC.IdAprobacion, ordenGiro_I.IdUsuarioUltAnu, ordenGiro_I.MotivoAnu, ref mensaje);
                        }

                        #endregion

                        ocXgastosxImp_B.AnularXOG(ordenGiro_I.IdEmpresa, ordenGiro_I.IdTipoCbte_Ogiro, ordenGiro_I.IdCbteCble_Ogiro,
                                                  Convert.ToInt32(ordenGiro_I.IdTipoCbte_Anulacion), Convert.ToDecimal(ordenGiro_I.IdCbteCble_Anulacion));

                        Importacion_B.EliminarDB(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, ordenGiro_I.IdTipoCbte_Ogiro);

                        OC_B.EliminarLista(LstImportacionOC);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            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("", "AnularFacturaProveedor", ex.Message), ex)
                      {
                          EntityType = typeof(cp_orden_giro_Bus)
                      };
            }
            return(res);
        }
コード例 #11
0
        public Boolean Validar_objeto_AprobIngEgrxOC(cp_Aprobacion_Ing_Bod_x_OC_Info Info, ref string msg)
        {
            try
            {
                if (Info.IdEmpresa == 0 || Info.IdProveedor == 0 || Info.IdProveedor == 0)
                {
                    msg = "las variables estan en cero... IdEmpresa == 0 || IdSucursal == 0 || IdProveedor == 0";
                    return(false);
                }

                Info.Observacion = Info.Observacion == null?"":Info.Observacion;

                if ((Info.Serie == null || Info.Serie == "") || (Info.Serie2 == null || Info.Serie2 == ""))
                {
                    msg = "Ingrese la Serie";
                    return(false);
                }
                if (Info.num_documento == null || Info.num_documento == "")
                {
                    msg = "Ingrese el Número de la Factura";
                    return(false);
                }

                if (Info.num_auto_Proveedor == null || Info.num_auto_Proveedor == "")
                {
                    msg = "Ingrese el Número Autorización del Proveedor";
                    return(false);
                }



                if (Info.Fecha_Factura == null)
                {
                    msg = "Ingrese la Fecha de la Factura";
                    return(false);
                }

                if (Info.IdOrden_giro_Tipo == null || Info.IdOrden_giro_Tipo == "")
                {
                    msg = "Ingrese el Tipo de Documento";
                    return(false);
                }

                if (Info.IdIden_credito == 0)
                {
                    msg = "Ingrese el Sustento Tributario";
                    return(false);
                }

                if (Info.listDetalle.Count == 0)
                {
                    msg = "El Detalle no tiene items q grabar o no ha seleccionado Items";
                    return(false);
                }



                foreach (var item in Info.listDetalle)
                {
                    if (String.IsNullOrEmpty(item.IdCtaCble_Gasto))
                    {
                        msg = "Ingrese la Cta. Contable de Gasto del siguiente registro OC#" + item.IdOrdenCompra + " Ing#" + item.IdNumMovi_Ing_Egr_Inv;
                        return(false);
                    }
                }

                if (String.IsNullOrEmpty(Info.IdCtaCble_CXP))
                {
                    cp_parametros_Data data_cpParam = new cp_parametros_Data();
                    cp_parametros_Info info_cpParam = new cp_parametros_Info();
                    info_cpParam = data_cpParam.Get_Info_parametros(Info.IdEmpresa);

                    if (!String.IsNullOrEmpty(info_cpParam.pa_ctacble_Proveedores_default))
                    {
                        Info.IdCtaCble_CXP = info_cpParam.pa_ctacble_Proveedores_default;
                    }
                    else
                    {
                        msg = "Ingrese la Cta. Contable del Proveedor";
                        return(false);
                    }
                }

                if (String.IsNullOrEmpty(Info.pa_ctacble_iva))
                {
                    cp_parametros_Info info_param_cp = new cp_parametros_Info();
                    cp_parametros_Bus  bus_param_cp  = new cp_parametros_Bus();
                    info_param_cp       = bus_param_cp.Get_Info_parametros(Info.IdEmpresa);
                    Info.pa_ctacble_iva = info_param_cp.pa_ctacble_iva;
                }

                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("", "Validar_objeto_AprobIngEgrxOC", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Aprobacion_Ing_Bod_x_OC_Bus)
                      };
            }
        }
コード例 #12
0
        public Boolean Generar_Orden_Giro(cp_Aprobacion_Ing_Bod_x_OC_Info Info, ref string msg)
        {
            try
            {
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> lstDet_OG = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
                cp_parametros_Data data_cpParam = new cp_parametros_Data();
                cp_parametros_Info info_cpParam = new cp_parametros_Info();
                info_cpParam = data_cpParam.Get_Info_parametros(Info.IdEmpresa);

                if (Info.IdCbteCble_Ogiro != 0 && Info.IdCbteCble_Ogiro != null)
                {
                    return(true);
                }

                #region Generar Info ct_Cbtecble
                //cabecera
                ct_Cbtecble_Info info_CbteCble = new ct_Cbtecble_Info();
                info_CbteCble.IdEmpresa      = Info.IdEmpresa;
                info_CbteCble.IdTipoCbte     = info_cpParam.pa_TipoCbte_OG;
                info_CbteCble.IdPeriodo      = Convert.ToInt32(Info.Fecha_Factura.ToString("yyyyMM"));
                info_CbteCble.cb_Fecha       = (Info.co_FechaContabilizacion == null) ? Info.Fecha_Factura : Convert.ToDateTime(Info.co_FechaContabilizacion);
                info_CbteCble.cb_Valor       = Info.co_total;
                info_CbteCble.cb_Observacion = Info.Observacion == "" ? "Diario generado con # Aprobación Ing. a Bod. por O/C: " + Info.IdAprobacion + ", con Tipo Comprabante #: " + info_cpParam.pa_TipoCbte_OG + " y Fecha Aprobación: " + Info.Fecha_aprobacion + "" : Info.Observacion;
                info_CbteCble.Secuencia      = 0;
                info_CbteCble.Estado         = "A";
                info_CbteCble.Anio           = Info.Fecha_Factura.Year;
                info_CbteCble.Mes            = Info.Fecha_Factura.Month;
                info_CbteCble.Mayorizado     = "N";

                //detalle
                List <ct_Cbtecble_det_Info> lista = new List <ct_Cbtecble_det_Info>();
                int Secuencia = 0;
                lstDet_OG = get_OG_x_Cta_Cble(Info.listDetalle);

                foreach (var item in lstDet_OG)
                {// gastos
                    ct_Cbtecble_det_Info InfoGasto = new ct_Cbtecble_det_Info();
                    Secuencia            = Secuencia + 1;
                    InfoGasto.IdEmpresa  = Info.IdEmpresa;
                    InfoGasto.IdTipoCbte = info_cpParam.pa_TipoCbte_OG;
                    InfoGasto.secuencia  = Secuencia;
                    InfoGasto.IdCtaCble  = item.IdCtaCble_Gasto;

                    InfoGasto.IdCentroCosto = item.IdCentro_Costo;
                    InfoGasto.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo;
                    InfoGasto.IdPunto_cargo_grupo            = item.IdPunto_cargo_grupo;
                    InfoGasto.IdPunto_cargo = item.IdPunto_cargo;

                    InfoGasto.dc_Valor           = item.SubTotal;
                    InfoGasto.dc_Observacion     = Info.Observacion == "" ? "Diario generado con # Aprobación Ing. a Bod. por O/C: " + Info.IdAprobacion + ", con Tipo Comprabante #: " + info_cpParam.pa_TipoCbte_OG + " y Fecha Aprobación: " + Info.Fecha_aprobacion + "" : Info.Observacion;
                    InfoGasto.dc_Numconciliacion = null;
                    InfoGasto.dc_EstaConciliado  = null;
                    lista.Add(InfoGasto);
                }


                if (Info.co_valoriva > 0)
                {
                    ct_Cbtecble_det_Info InfoIva = new ct_Cbtecble_det_Info();

                    InfoIva.IdEmpresa  = Info.IdEmpresa;
                    InfoIva.IdTipoCbte = info_cpParam.pa_TipoCbte_OG;
                    InfoIva.secuencia  = Secuencia + 2;
                    InfoIva.IdCtaCble  = Info.pa_ctacble_iva.Trim();
                    //InfoIva.IdCentroCosto = null;
                    //InfoIva.IdCentroCosto_sub_centro_costo = null;
                    InfoIva.dc_Valor           = Info.co_valoriva;
                    InfoIva.dc_Observacion     = Info.Observacion == "" ? "Diario generado con # Aprobación Ing. a Bod. por O/C: " + Info.IdAprobacion + ", con Tipo Comprabante #: " + info_cpParam.pa_TipoCbte_OG + " y Fecha Aprobación: " + Info.Fecha_aprobacion + "" : Info.Observacion;
                    InfoIva.dc_Numconciliacion = null;
                    InfoIva.dc_EstaConciliado  = null;
                    lista.Add(InfoIva);
                }

                ct_Cbtecble_det_Info InfoCXP = new ct_Cbtecble_det_Info();
                InfoCXP.IdEmpresa  = Info.IdEmpresa;
                InfoCXP.IdTipoCbte = info_cpParam.pa_TipoCbte_OG;
                InfoCXP.secuencia  = Secuencia + 1;
                InfoCXP.IdCtaCble  = Info.IdCtaCble_CXP.Trim();
                //InfoCXP.IdCentroCosto = Info.IdCentroCosoto_CXP;
                //InfoCXP.IdCentroCosto_sub_centro_costo = null;
                InfoCXP.dc_Valor           = Info.co_total * -1;
                InfoCXP.dc_Observacion     = Info.Observacion == "" ? "Diario generado con # Aprobación Ing. a Bod. por O/C: " + Info.IdAprobacion + ", con Tipo Comprabante #: " + info_cpParam.pa_TipoCbte_OG + " y Fecha Aprobación: " + Info.Fecha_aprobacion + "" : Info.Observacion;
                InfoCXP.dc_Numconciliacion = null;
                InfoCXP.dc_EstaConciliado  = null;
                lista.Add(InfoCXP);

                info_CbteCble._cbteCble_det_lista_info = lista;

                //grabar diario

                #endregion

                #region Genere cp_orden_giro_Info y graba Orden Giro


                //Generar Info cp_orden_giro
                cp_orden_giro_Info Info_Ogiro = new cp_orden_giro_Info();
                Info_Ogiro.IdEmpresa                = Info.IdEmpresa;
                Info_Ogiro.IdTipoCbte_Ogiro         = info_cpParam.pa_TipoCbte_OG;
                Info_Ogiro.IdOrden_giro_Tipo        = Info.IdOrden_giro_Tipo;
                Info_Ogiro.IdProveedor              = Info.IdProveedor;
                Info_Ogiro.co_fechaOg               = Info.Fecha_aprobacion;
                Info_Ogiro.co_FechaFactura          = Info.Fecha_Factura;
                Info_Ogiro.co_FechaFactura_vct      = Info.Fecha_vcto;
                Info_Ogiro.co_plazo                 = Info.co_plazo;
                Info_Ogiro.co_FechaContabilizacion  = (Info.co_FechaContabilizacion == null) ? Info.Fecha_Factura : Info.co_FechaContabilizacion;
                Info_Ogiro.co_serie                 = Info.Serie + "-" + Info.Serie2;
                Info_Ogiro.Num_Autorizacion         = Info.num_auto_Proveedor;
                Info_Ogiro.co_factura               = Info.num_documento;
                Info_Ogiro.co_observacion           = Info.Observacion;
                Info_Ogiro.co_subtotal_iva          = Info.co_subtotal_iva;
                Info_Ogiro.co_subtotal_siniva       = Info.co_subtotal_siniva;
                Info_Ogiro.co_baseImponible         = Info.co_baseImponible;
                Info_Ogiro.co_Por_iva               = Info.co_Por_iva;
                Info_Ogiro.co_valoriva              = Info.co_valoriva;
                Info_Ogiro.IdCod_ICE                = 866;//NO APLICA
                Info_Ogiro.co_Ice_base              = 0;
                Info_Ogiro.co_Ice_por               = 0;
                Info_Ogiro.co_Ice_valor             = 0;
                Info_Ogiro.co_Serv_valor            = 0;
                Info_Ogiro.co_Serv_por              = 0;
                Info_Ogiro.co_OtroValor_a_descontar = 0;
                Info_Ogiro.co_OtroValor_a_Sumar     = 0;
                Info_Ogiro.co_BaseSeguro            = 0;
                Info_Ogiro.co_total                 = Info.co_total;
                Info_Ogiro.co_valorpagar            = Info.co_total;
                Info_Ogiro.co_vaCoa                 = "S";
                Info_Ogiro.IdIden_credito           = Info.IdIden_credito;
                Info_Ogiro.IdCod_101                = 837;//No Aplica
                Info_Ogiro.IdTipoFlujo              = null;
                Info_Ogiro.IdTipoServicio           = "BIEN";
                Info_Ogiro.IdCtaCble_Gasto          = Info.IdCtaCble_Gasto;
                Info_Ogiro.IdTipoMovi               = Info.IdTipoMovi;
                Info_Ogiro.IdCtaCble_IVA            = Info.co_valoriva > 0 ? Info.pa_ctacble_iva.Trim() : null;
                Info_Ogiro.Estado = "A";

                Info_Ogiro.IdUsuario     = "";
                Info_Ogiro.Fecha_Transac = DateTime.Now;

                Info_Ogiro.IdUsuarioUltMod = "";
                Info_Ogiro.Fecha_UltMod    = null;
                Info_Ogiro.IdUsuarioUltAnu = null;
                Info_Ogiro.MotivoAnu       = null;
                Info_Ogiro.nom_pc          = "";
                Info_Ogiro.Fecha_UltAnu    = null;
                Info_Ogiro.ip = "";

                Info_Ogiro.co_retencionManual   = "S";
                Info_Ogiro.IdCbteCble_Anulacion = null;
                Info_Ogiro.IdTipoCbte_Anulacion = null;
                Info_Ogiro.IdCentroCosto        = null;
                Info_Ogiro.IdSucursal           = 1;
                Info_Ogiro.PagoLocExt           = "LOC";
                Info_Ogiro.PaisPago             = null;
                Info_Ogiro.ConvenioTributacion  = "NO";
                Info_Ogiro.PagoSujetoRetencion  = "NO";
                Info_Ogiro.BseImpNoObjDeIva     = 0;

                Info_Ogiro.Num_Autorizacion_Imprenta = Info.num_auto_Imprenta;

                Info_Ogiro.fecha_autorizacion = Info.fecha_autorizacion;

                //verificar Id_Num_Autorizacion
                cp_Autorizacion_x_Doc_x_Pag_Data data_NumAuto = new cp_Autorizacion_x_Doc_x_Pag_Data();
                string msge = "";
                if (!data_NumAuto.Verificar_NumAutorizacion_Ogiro(Info.num_auto_Proveedor, ref msge))
                {
                    //grabar
                    cp_Autorizacion_x_Doc_x_Pag_Info info = new cp_Autorizacion_x_Doc_x_Pag_Info();
                    info.Id_Num_Autorizacion = Info.num_auto_Proveedor;

                    data_NumAuto.GuardarDB(info, ref msge);

                    Info_Ogiro.Num_Autorizacion = Info.num_auto_Proveedor;
                }

                cp_orden_giro_Bus                   BusOrdenGiro_B    = new cp_orden_giro_Bus();
                List <cp_reembolso_Info>            lst_reembolso     = null;
                List <cp_orden_giro_pagos_sri_Info> lst_formasPagoSRI = null;
                cp_retencion_Info                   InfoRetencion     = null;
                ct_Cbtecble_Info InfoCbteCble_x_Ret = null;

                string es_332_333_334 = "";


                List <imp_ordencompra_ext_x_imp_gastosxImport_Info> LstImportacionGrid = null;
                List <imp_ordencompra_ext_x_ct_cbtecble_Info>       LstocXcbt_I        = null;
                List <cp_orden_giro_x_imp_ordencompra_ext_Info>     LisImportacion     = null;
                List <cp_orden_giro_x_com_ordencompra_local_Info>   LstImportacionOC   = null;
                decimal idCbteCble = 0;

                Info_Ogiro.Info_CbteCble_x_OG = info_CbteCble;
                Info_Ogiro.lst_formasPagoSRI  = lst_formasPagoSRI;
                Info_Ogiro.Info_Retencion     = InfoRetencion;

                if (Info_Ogiro.Info_Retencion != null)
                {
                    Info_Ogiro.Info_Retencion.Info_CbteCble_x_RT = InfoCbteCble_x_Ret;
                }


                Info_Ogiro.LstImportacionOC = LstImportacionOC;


                if (BusOrdenGiro_B.ExisteFacturaPorProveedor(Info_Ogiro.IdEmpresa, Info_Ogiro.IdProveedor, Info_Ogiro.co_serie, Info_Ogiro.co_factura))
                {
                    if (BusOrdenGiro_B.ModificarDB(Info_Ogiro, ref msg))
                    {
                        Info.IdEmpresa_Ogiro  = Info_Ogiro.IdEmpresa;
                        Info.IdCbteCble_Ogiro = Info_Ogiro.IdCbteCble_Ogiro;
                        Info.IdTipoCbte_Ogiro = Info_Ogiro.IdTipoCbte_Ogiro;
                    }
                }
                else
                {
                    if (BusOrdenGiro_B.GrabarDB(Info_Ogiro, ref idCbteCble, ref msg))
                    {
                        Info.IdEmpresa_Ogiro  = Info_Ogiro.IdEmpresa;
                        Info.IdCbteCble_Ogiro = Info_Ogiro.IdCbteCble_Ogiro;
                        Info.IdTipoCbte_Ogiro = Info_Ogiro.IdTipoCbte_Ogiro;
                    }
                }


                #endregion


                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("", "Generar_Orden_Giro", ex.Message), ex)
                      {
                          EntityType = typeof(cp_Aprobacion_Ing_Bod_x_OC_Bus)
                      };
            }
        }
コード例 #13
0
        public Boolean GuardarDB(cp_Aprobacion_Ing_Bod_x_OC_Info Info, ref decimal id, ref string msg)
        {
            try
            {
                Boolean res = true;

                if (Validar_objeto_AprobIngEgrxOC(Info, ref msg))
                {
                    //cabecera
                    res = odata.GuardarDB(Info, ref id, ref msg);

                    if (res == false)
                    {
                        return(res);
                    }

                    Info.IdAprobacion = id;

                    if (res = Generar_Orden_Giro(Info, ref msg))
                    {
                        if (res == false)
                        {
                            return(res);
                        }
                        else
                        {
                            //Info.IdEmpresa_Ogiro = 2;
                            //Info.IdCbteCble_Ogiro = 170;
                            //Info.IdTipoCbte_Ogiro = 7;
                            // actualizar campos cp_aprobacion
                            res = odata.ModificarDB(Info, ref msg);
                            if (res == false)
                            {
                                return(res);
                            }

                            // grabar tabla intermedia cp_orden_giro_x_com_ordencompra_local_det
                            int sec = 1;
                            foreach (var item in Info.listDetalle)
                            {
                                cp_orden_giro_x_com_ordencompra_local_det_Info info = new cp_orden_giro_x_com_ordencompra_local_det_Info();

                                info.IdEmpresa_Ogiro  = Convert.ToInt32(Info.IdEmpresa_Ogiro);
                                info.IdCbteCble_Ogiro = Convert.ToDecimal(Info.IdCbteCble_Ogiro);
                                info.IdTipoCbte_Ogiro = Convert.ToInt32(Info.IdTipoCbte_Ogiro);

                                info.IdEmpresa_OC  = item.IdEmpresa_Ing_Egr_Inv;
                                info.IdSucursal_OC = item.IdSucursal_OC;
                                info.IdOrdenCompra = item.IdOrdenCompra;
                                info.Secuencia_OC  = item.Secuencia_OC;
                                info.Secuencia_reg = sec;
                                sec++;
                                string msje = "";
                                cp_orden_giro_x_com_ordencompra_local_det_Bus bus = new cp_orden_giro_x_com_ordencompra_local_det_Bus();
                                if (bus.GrabarDB(info, ref msje))
                                {
                                }
                            }
                        }
                    }
                }
                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(cp_Aprobacion_Ing_Bod_x_OC_Bus)
                      };
            }
        }
コード例 #14
0
        public Boolean EliminarDB(int IdEmpresa, decimal IdAprobacion, string IdUsuario, string MotivoAnula, ref string msg)
        {
            try
            {
                #region Guaarda las aprobaciones eliminadas en otra tabla
                //para extraer los datos antes de eliminar
                cp_Aprobacion_Ing_Bod_x_OC_Info            info             = new cp_Aprobacion_Ing_Bod_x_OC_Info();
                cp_Aprobacion_Ing_Bod_x_OC_Bus             Bus_Info         = new cp_Aprobacion_Ing_Bod_x_OC_Bus();
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lista_Info       = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();
                cp_Aprobacion_Ing_Bod_x_OC_det_Bus         Bus_info_detalle = new cp_Aprobacion_Ing_Bod_x_OC_det_Bus();

                info             = Bus_Info.Get_Info_Aprobacion_Ing_Bod_x_OC(IdEmpresa, IdAprobacion);
                info.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>();

                Lista_Info       = Bus_info_detalle.Get_List_Aprobacion_Ing_Bod_x_OC_det(IdEmpresa, IdAprobacion);
                info.listDetalle = Lista_Info;

                //para guargar en la tabla cp_Aprobacion_Ing_Bod_x_OC_Eliminados cabecera y detalle
                cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Info            Info_Eliminado        = new cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Info();
                cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Bus             bus_Aprobar_Eliminado = new cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Bus();
                List <cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info> Lista = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info>();

                bool respuesta = false;

                Info_Eliminado.IdEmpresa          = info.IdEmpresa;
                Info_Eliminado.IdAprobacion       = info.IdAprobacion;
                Info_Eliminado.Fecha_aprobacion   = info.Fecha_aprobacion;
                Info_Eliminado.IdEmpresa_Ogiro    = info.IdEmpresa_Ogiro;
                Info_Eliminado.IdCbteCble_Ogiro   = info.IdCbteCble_Ogiro;
                Info_Eliminado.IdTipoCbte_Ogiro   = info.IdTipoCbte_Ogiro;
                Info_Eliminado.IdOrden_giro_Tipo  = info.IdOrden_giro_Tipo;
                Info_Eliminado.IdIden_credito     = info.IdIden_credito;
                Info_Eliminado.IdProveedor        = info.IdProveedor;
                Info_Eliminado.Observacion        = info.Observacion;
                Info_Eliminado.Serie              = info.Serie;
                Info_Eliminado.Serie2             = info.Serie2;
                Info_Eliminado.num_documento      = info.num_documento;
                Info_Eliminado.num_auto_Proveedor = info.num_auto_Proveedor;
                Info_Eliminado.num_auto_Imprenta  = info.num_auto_Imprenta;
                Info_Eliminado.Fecha_Factura      = info.Fecha_Factura;
                Info_Eliminado.co_subtotal_iva    = info.co_subtotal_iva;
                Info_Eliminado.co_subtotal_siniva = info.co_subtotal_siniva;
                Info_Eliminado.Descuento          = info.Descuento;
                Info_Eliminado.co_baseImponible   = info.co_baseImponible;
                Info_Eliminado.co_Por_iva         = info.co_Por_iva;
                Info_Eliminado.co_valoriva        = info.co_valoriva;
                Info_Eliminado.co_total           = info.co_total;
                Info_Eliminado.co_plazo           = info.co_plazo;
                Info_Eliminado.Fecha_Anulacion    = DateTime.Now;
                Info_Eliminado.IdUsuario_Anu      = IdUsuario;
                Info_Eliminado.Motivo_Anu         = MotivoAnula;
                Info_Eliminado.listDetalle        = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info>();

                foreach (var item in info.listDetalle)
                {
                    cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info Eliminado = new cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info();
                    Eliminado.IdEmpresa              = item.IdEmpresa;
                    Eliminado.IdAprobacion           = item.IdAprobacion;
                    Eliminado.Secuencia              = item.Secuencia;
                    Eliminado.IdEmpresa_Ing_Egr_Inv  = item.IdEmpresa_Ing_Egr_Inv;
                    Eliminado.IdSucursal_Ing_Egr_Inv = item.IdSucursal_Ing_Egr_Inv;
                    Eliminado.IdNumMovi_Ing_Egr_Inv  = item.IdNumMovi_Ing_Egr_Inv;
                    Eliminado.Secuencia_Ing_Egr_Inv  = item.Secuencia_Ing_Egr_Inv;
                    Eliminado.Cantidad        = item.Cantidad;
                    Eliminado.Costo_uni       = item.Costo_uni;
                    Eliminado.Descuento       = item.Descuento;
                    Eliminado.SubTotal        = item.SubTotal;
                    Eliminado.PorIva          = item.PorIva;
                    Eliminado.valor_Iva       = item.valor_Iva;
                    Eliminado.Total           = item.Total;
                    Eliminado.IdCtaCble_Gasto = item.IdCtaCble_Gasto;
                    Eliminado.IdCtaCble_IVA   = item.IdCtaCble_IVA;
                    Eliminado.IdCentro_Costo_x_Gasto_x_cxp       = item.IdCentro_Costo;
                    Eliminado.IdCentroCosto_sub_centro_costo_cxp = item.IdCentroCosto_sub_centro_costo;
                    Eliminado.IdMovi_inven_tipo_Ing_Egr_Inv      = item.IdMovi_inven_tipo_Ing_Egr_Inv;
                    Lista.Add(Eliminado);
                }
                Info_Eliminado.listDetalle = Lista;

                respuesta = bus_Aprobar_Eliminado.GuardarDB(Info_Eliminado, ref msg);

                #endregion

                if (respuesta)
                {
                    respuesta = odata.EliminarDB(info.IdEmpresa, info.IdAprobacion, ref msg);
                }
                else
                {
                    msg       = "No se pudo eliminar la aprobación seleccionada, favor comuniquese con sistemas";
                    respuesta = false;
                }
                return(respuesta);
            }
            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(cp_Aprobacion_Ing_Bod_x_OC_Bus)
                      };
            }
        }
コード例 #15
0
        public Boolean GuardarDB(cp_Aprobacion_Ing_Bod_x_OC_Info Info, ref decimal Id, ref string msg)
        {
            try
            {
                using (EntitiesCuentasxPagar CxP = new EntitiesCuentasxPagar())
                {
                    cp_Aprobacion_Ing_Bod_x_OC Address = new cp_Aprobacion_Ing_Bod_x_OC();

                    Address.IdEmpresa        = Info.IdEmpresa;
                    Address.IdAprobacion     = Id = GetId(Info.IdEmpresa);
                    Address.Fecha_Factura    = Convert.ToDateTime(Info.Fecha_Factura.ToShortDateString());
                    Address.Fecha_aprobacion = Convert.ToDateTime(Info.Fecha_Factura.ToShortDateString());
                    Address.IdEmpresa_Ogiro  = Info.IdEmpresa_Ogiro;
                    Address.IdCbteCble_Ogiro = Info.IdCbteCble_Ogiro;
                    Address.IdTipoCbte_Ogiro = Info.IdTipoCbte_Ogiro;

                    Address.IdOrden_giro_Tipo = Info.IdOrden_giro_Tipo;
                    Address.IdIden_credito    = Info.IdIden_credito;

                    Address.IdProveedor              = Info.IdProveedor;
                    Address.Observacion              = Info.Observacion;
                    Address.Serie                    = Info.Serie;
                    Address.Serie2                   = Info.Serie2;
                    Address.num_documento            = Info.num_documento;
                    Address.num_auto_Proveedor       = Info.num_auto_Proveedor;
                    Address.num_auto_Imprenta        = Info.num_auto_Imprenta;
                    Address.co_subtotal_iva          = Info.co_subtotal_iva;
                    Address.co_subtotal_siniva       = Info.co_subtotal_siniva;
                    Address.Descuento                = Info.Descuento;
                    Address.co_baseImponible         = Info.co_baseImponible;
                    Address.co_Por_iva               = Info.co_Por_iva;
                    Address.co_valoriva              = Info.co_valoriva;
                    Address.co_total                 = Info.co_total;
                    Address.co_plazo                 = Info.co_plazo;
                    Address.co_FechaVctoAutorizacion = Info.co_FechaVctoAutorizacion;
                    CxP.cp_Aprobacion_Ing_Bod_x_OC.Add(Address);
                    CxP.SaveChanges();

                    //grabar detalle

                    foreach (var item in Info.listDetalle)
                    {
                        item.IdEmpresa    = Info.IdEmpresa;
                        item.IdAprobacion = Id;
                    }
                    // detalle

                    data_Det.GuardarDB(Info.listDetalle, ref msg);
                }
                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.InnerException + " " + ex.Message;
                msg     = mensaje;
                throw new Exception(ex.InnerException.ToString());
            }
        }
コード例 #16
0
        public List <cp_Aprobacion_Ing_Bod_x_OC_Info> Get_List_Aprobacion_Ing_Bod_x_OC(int IdEmpresa, DateTime FechaIni, DateTime FechaFin)
        {
            List <cp_Aprobacion_Ing_Bod_x_OC_Info> Lst = new List <cp_Aprobacion_Ing_Bod_x_OC_Info>();
            EntitiesCuentasxPagar CxP = new EntitiesCuentasxPagar();

            try
            {
                FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString());
                FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString());

                var Select = from q in CxP.vwcp_Aprobacion_Ing_Bod_x_OC
                             where q.IdEmpresa == IdEmpresa

                             && q.Fecha_aprobacion <= FechaFin &&
                             q.Fecha_aprobacion >= FechaIni


                             select q;

                foreach (var item in Select)
                {
                    cp_Aprobacion_Ing_Bod_x_OC_Info info = new cp_Aprobacion_Ing_Bod_x_OC_Info();

                    info.IdEmpresa        = item.IdEmpresa;
                    info.IdAprobacion     = item.IdAprobacion;
                    info.Fecha_Factura    = item.Fecha_Factura;
                    info.Fecha_aprobacion = item.Fecha_aprobacion;
                    info.IdEmpresa_Ogiro  = item.IdEmpresa_Ogiro;
                    info.IdCbteCble_Ogiro = item.IdCbteCble_Ogiro;
                    info.IdTipoCbte_Ogiro = item.IdTipoCbte_Ogiro;

                    info.IdOrden_giro_Tipo = item.IdOrden_giro_Tipo;
                    info.IdIden_credito    = item.IdIden_credito;

                    info.IdProveedor              = item.IdProveedor;
                    info.Observacion              = item.Observacion;
                    info.Serie                    = item.Serie;
                    info.Serie2                   = item.Serie2;
                    info.num_documento            = item.num_documento;
                    info.num_auto_Proveedor       = item.num_auto_Proveedor;
                    info.num_auto_Imprenta        = item.num_auto_Imprenta;
                    info.co_subtotal_iva          = item.co_subtotal_iva;
                    info.co_subtotal_siniva       = item.co_subtotal_siniva;
                    info.Descuento                = item.Descuento;
                    info.co_baseImponible         = item.co_baseImponible;
                    info.co_Por_iva               = item.co_Por_iva;
                    info.co_valoriva              = item.co_valoriva;
                    info.co_total                 = item.co_total;
                    info.co_FechaVctoAutorizacion = item.co_FechaVctoAutorizacion;
                    info.nom_proveedor            = item.nom_proveedor;

                    Lst.Add(info);
                }
                return(Lst);
            }
            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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }