Esempio n. 1
0
        /// <summary>
        /// Actualiza el total
        /// </summary>
        public int UpdateTotal(string pStrCode)
        {
            int lIntResult = -1;

            try
            {
                PurchasesServiceFactory mObjPurchaseServiceFactory = new PurchasesServiceFactory();
                var lObjVoucher = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVouches(pStrCode);
                if (lObjVoucher.Count > 0)
                {
                    List <VouchersDetailDTO> lLstVouchersDetail = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetInvoiceVouchesDetail(lObjVoucher[0].Area, lObjVoucher[0].Folio);
                    lObjVoucher[0].Total = lLstVouchersDetail.Where(x => x.Status != "Cancelado").Sum(x => x.Total);

                    // lObjVoucher[0].Total = pDblTotal;
                    // lObjVoucher[0].Total = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVouchesDetail(pStrCode).Where(x => x.Status != "Cancelado").Sum(x => x.Total);
                    lIntResult = mObjPurchaseServiceFactory.GetVouchersService().Update(lObjVoucher[0]);
                    if (lIntResult != 0)
                    {
                        UIApplication.ShowMessageBox(string.Format("Exception: {0}", DIApplication.Company.GetLastErrorDescription()));
                        LogService.WriteError("InvoiceDI (AddVoucherDetail) " + DIApplication.Company.GetLastErrorDescription());
                    }
                }
                else
                {
                    LogService.WriteError("VouchersService: Comprobante no encontrado: " + pStrCode);
                }
            }
            catch (System.Exception ex)
            {
                LogService.WriteError("VouchersService (UpdateTotal) " + ex.Message);
                LogService.WriteError(ex);
            }

            return(lIntResult);
        }
Esempio n. 2
0
        //Actualiza status de comprobante
        private bool UpdateCancel(string pStrDocEntry, string pStrCodeVoucher)
        {
            bool lBolResult = false;

            try
            {
                List <VouchersDetail> lLstVouchersDetail = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVoucherDetailByTrans(pStrDocEntry);
                if (lLstVouchersDetail.Count > 0)
                {
                    VouchersDetail lObjVoucherDetail = lLstVouchersDetail.Where(x => x.DocEntry == pStrDocEntry).FirstOrDefault();
                    lObjVoucherDetail.Status = "Cancelado";

                    if (mObjPurchaseServiceFactory.GetVouchersDetailService().Update(lObjVoucherDetail) == 0)
                    {
                        mObjPurchaseServiceFactory.GetVouchersService().UpdateTotal(pStrCodeVoucher);
                        lBolResult = true;
                        LogService.WriteSuccess("PolicyDI (UpdateCancel) Cancelacion realizada correctamente, TransId: " + pStrDocEntry);
                    }
                    else
                    {
                        lBolResult = false;
                        LogService.WriteError("PolicyDI (UpdateCancel)  TransId:" + pStrDocEntry + " Mensaje:" + DIApplication.Company.GetLastErrorDescription());
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("PolicyDI (UpdateCancel) TransId:" + pStrDocEntry + " Mensaje:" + ex.Message);
                LogService.WriteError(ex);
            }
            return(lBolResult);
        }
Esempio n. 3
0
        /// <summary>
        /// Actualiza  estatus
        /// </summary>
        public void UpdateStatus(string pStrCode, string pStrDocEntry, string pStrCodeVoucher)
        {
            try
            {
                VouchersDetail lObjVoucher = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVouchesDetail(pStrCode).Where(x => x.DocEntry == pStrDocEntry).First();
                if (!string.IsNullOrEmpty(lObjVoucher.DocEntry))
                {
                    string lStrDocStatus = mObjPurchaseServiceFactory.GetPurchaseInvoiceService().GetDocCanceled(pStrDocEntry, lObjVoucher.Type);
                    if (!lStrDocStatus.Equals("Cancelado"))
                    {
                        lStrDocStatus = mObjPurchaseServiceFactory.GetPurchaseInvoiceService().GetDocStatus(pStrDocEntry);
                    }


                    lObjVoucher.Status = lStrDocStatus;
                    if (mObjPurchaseServiceFactory.GetVouchersDetailService().Update(lObjVoucher) != 0)
                    {
                        UIApplication.ShowMessageBox(string.Format("Exception: {0}", DIApplication.Company.GetLastErrorDescription()));
                        LogService.WriteError("InvoiceDI (AddVoucherDetail) " + DIApplication.Company.GetLastErrorDescription());
                    }
                    else
                    {
                        mObjPurchaseServiceFactory.GetVouchersService().UpdateTotal(pStrCodeVoucher);
                    }
                }
            }
            catch (Exception ex)
            {
                LogService.WriteError("InvoiceDI (UpdateStatus) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Esempio n. 4
0
        private void LoadCombobxBank()
        {
            int lIntValuesLength = cbBank.ValidValues.Count - 1;

            for (int i = 0; i < lIntValuesLength + 1; i++)
            {
                cbBank.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
            }

            IList <BankDTO> lLstObjBanks = mObjPurchasesServiceFactory.GetPurchaseVouchersService().GetBankList();

            cbBank.ValidValues.Add("", "");
            foreach (BankDTO lObjBank in lLstObjBanks)
            {
                cbBank.ValidValues.Add(lObjBank.BankCode, lObjBank.BankName);
            }
        }
Esempio n. 5
0
        private void Search()
        {
            try
            {
                SearchVouchersDTO lObjSearchVouchers = new SearchVouchersDTO();
                lObjSearchVouchers.Area = txtArea.Value;
                if (string.IsNullOrEmpty(txtEmploye.Value))
                {
                    mStrEmployeId = "";
                }
                if (string.IsNullOrEmpty(cboStatus.Value))
                {
                    lObjSearchVouchers.Status = 0;
                }
                else
                {
                    lObjSearchVouchers.Status = Convert.ToInt32(cboStatus.Value);
                }

                lObjSearchVouchers.Employee  = mStrEmployeId;
                lObjSearchVouchers.StartDate = txtStartD.Value;
                lObjSearchVouchers.EndDate   = txtEndDate.Value;

                List <Vouchers> lLstVouchers = new List <Vouchers>();
                lLstVouchers = mObjPurchasesServiceFactory.GetPurchaseVouchersService().GetVouchersList(lObjSearchVouchers).ToList();
                if (DtMatrix == null)
                {
                    CreateDataTableMatrix();
                }
                else
                {
                    DtMatrix.Rows.Clear();
                }
                FillMatrix(lLstVouchers);
            }
            catch (Exception ex)
            {
                UIApplication.ShowMessageBox(ex.Message);
                LogService.WriteError("frmSearchRefunds (btnSearch_ClickBefore) " + ex.Message);
                LogService.WriteError(ex);
            }
        }
Esempio n. 6
0
        public int Update(string pStrCode, StatusEnum pEnumStatus)
        {
            PurchasesServiceFactory mObjPurchaseServiceFactory = new PurchasesServiceFactory();
            var lObjVoucher = mObjPurchaseServiceFactory.GetPurchaseVouchersService().GetVouches(pStrCode);

            if (lObjVoucher.Count > 0)
            {
                lObjVoucher[0].Status = (int)pEnumStatus;
                return(mObjVouchersDAO.Update(lObjVoucher[0]));
            }
            return(-1);
        }