Пример #1
0
        public JsonResult SaveCBReceipt(NetStock.Contract.CBReceipt CBReceiptdata)
        {
            try
            {
                CBReceiptdata.CreatedBy    = Utility.DEFAULTUSER;
                CBReceiptdata.ModifiedBy   = Utility.DEFAULTUSER;
                CBReceiptdata.Source       = "CB";
                CBReceiptdata.CurrencyCode = "THB";
                CBReceiptdata.BranchID     = Utility.SsnBranch;

                if (CBReceiptdata.CBReceiptDetails != null)
                {
                    foreach (var item in CBReceiptdata.CBReceiptDetails)
                    {
                        item.MatchDocumentDate = DateTime.UtcNow.ThaiTime();
                    }
                }

                var result = new NetStock.BusinessFactory.CBReceiptBO().SaveCBReceipt(CBReceiptdata);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);
            }

            return(Json(new { success = true, Message = "CBReceipt saved successfully.", CBReceiptdata = CBReceiptdata }));

            //return RedirectToAction("CBReceipt", new { CBReceiptType = "", DocumentNo = CBReceiptdata.DocumentNo });
        }
Пример #2
0
        public PartialViewResult AddCBReceiptItem(string documentNo, Int16 itemNo)
        {
            CBReceiptDetail cbReceiptDetail = null;

            if (documentNo == string.Empty || documentNo == null)
            {
                cbReceiptDetail            = new CBReceiptDetail();
                cbReceiptDetail.SetOffDate = DateTime.Now;
            }
            else
            {
                cbReceiptDetail = new NetStock.BusinessFactory.CBReceiptBO().GetCBReceipt(new Contract.CBReceipt {
                    DocumentNo = documentNo
                })
                                  .CBReceiptDetails.Where(dt => dt.ItemNo == itemNo).FirstOrDefault();
                if (cbReceiptDetail == null)
                {
                    cbReceiptDetail = new CBReceiptDetail();
                }
            }

            cbReceiptDetail.CurrencyList    = Utility.GetCurrencyItemList();
            cbReceiptDetail.AccountCodeList = Utility.GetAccountCodeItemList();
            cbReceiptDetail.ChargeCodeList  = Utility.GetChargeCodeItemList();
            return(PartialView("AddChargeCodeReceipt", cbReceiptDetail));
            //return PartialView("AddQuotationItem");
        }
Пример #3
0
        public JsonResult SearchItem(string searchText, int limitRecords, string source = null)
        {
            try
            {
                IQueryable <CBReceipt> _iQCBReceipt;
                _iQCBReceipt = new NetStock.BusinessFactory.CBReceiptBO().GetList().AsQueryable();//.GetARInvoice(searchText, limitRecords);
                //var res = (from r in result where r.BranchID.ToString().Contains(searchText) select r.BranchID).ToList();

                return(Json(new { data = _iQCBReceipt }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
        }
Пример #4
0
        public ActionResult CBReceipt(string CBReceiptType, string DocumentNo)
        {
            CBReceipt cbReceipt = null;

            if (DocumentNo == Utility.NEWRECORD)
            {
                cbReceipt = new CBReceipt();
                cbReceipt.DocumentDate = DateTime.UtcNow.ThaiTime();
                cbReceipt.AccountDate  = DateTime.UtcNow.ThaiTime();
                cbReceipt.ChequeDate   = DateTime.UtcNow.ThaiTime();
                //cbpayment.AccountDate =null;
                cbReceipt.CBReceiptDetails       = new List <CBReceiptDetail>();
                cbReceipt.CBReceiptSetOffDetails = new List <CBReceiptSetOffDetail>();
                cbReceipt.CBReceiptGLDetails     = new List <CBReceiptGlDetail>();
            }
            else
            {
                var cbpaymentBO = new NetStock.BusinessFactory.CBReceiptBO();
                if (DocumentNo != null && DocumentNo != "")
                {
                    //cbReceipt = new NetStock.BusinessFactory.CBReceiptBO().GetList().Where(x => x.DocumentNo == DocumentNo).FirstOrDefault();

                    cbReceipt = new NetStock.BusinessFactory.CBReceiptBO().GetCBReceipt(new CBReceipt {
                        BranchID = Utility.SsnBranch, DocumentNo = DocumentNo
                    });
                }
                else
                {
                    cbReceipt = new NetStock.BusinessFactory.CBReceiptBO().GetList().FirstOrDefault();

                    cbReceipt.CBReceiptDetails       = new List <CBReceiptDetail>();
                    cbReceipt.CBReceiptSetOffDetails = new List <CBReceiptSetOffDetail>();
                    cbReceipt.CBReceiptGLDetails     = new List <CBReceiptGlDetail>();
                }
            }

            cbReceipt.ReceiptTypeList  = Utility.GetReceiptTypeList("ReceiptType");
            cbReceipt.DebtorList       = Utility.GetDebtorList();
            cbReceipt.BankCodeList     = Utility.GetBankCodeList();
            cbReceipt.CurrencyCodeList = Utility.GetCurrencyItemList();
            return(View("CBReceipt", cbReceipt));
        }
Пример #5
0
        public ActionResult CBSearchReceipt(string DocumentNo)
        {
            if (DocumentNo != "0")
            {
                CBReceipt cbReceipt = null;

                var cbpaymentBO = new NetStock.BusinessFactory.CBReceiptBO();
                var c           = new NetStock.BusinessFactory.CBReceiptBO().GetList();
                cbReceipt = new NetStock.BusinessFactory.CBReceiptBO().GetList().Where(x => x.DocumentNo == DocumentNo).FirstOrDefault();

                if (cbReceipt == null)
                {
                    cbReceipt = new CBReceipt();
                }
                if (cbReceipt.DocumentNo != null)
                {
                    cbReceipt.CBReceiptDetails       = new NetStock.BusinessFactory.CBReceiptDetailBO().GetListByDocumentNo(cbReceipt.DocumentNo);
                    cbReceipt.CBReceiptSetOffDetails = new List <CBReceiptSetOffDetail>();
                    cbReceipt.CBReceiptGLDetails     = new List <CBReceiptGlDetail>();
                }
                else
                {
                    cbReceipt.CBReceiptDetails       = new List <CBReceiptDetail>();
                    cbReceipt.CBReceiptSetOffDetails = new List <CBReceiptSetOffDetail>();
                    cbReceipt.CBReceiptGLDetails     = new List <CBReceiptGlDetail>();
                }

                //}
                cbReceipt.DocumentDate     = DateTime.Today.Date;
                cbReceipt.ReceiptTypeList  = Utility.GetReceiptTypeList("ReceiptType");
                cbReceipt.DebtorList       = Utility.GetDebtorList();
                cbReceipt.BankCodeList     = Utility.GetBankCodeList();
                cbReceipt.CurrencyCodeList = Utility.GetCurrencyItemList();
                return(RedirectToAction("CBReceipt", new { CBReceiptType = "", DocumentNo = DocumentNo }));
                //return View("CBReceipt", cbReceipt);
            }
            else
            {
                return(RedirectToAction("CBReceipt"));
            }
        }
Пример #6
0
        public JsonResult DeleteCBReceipt(string documentNo, string cancelBy)
        {
            //CBReceipt CBReceiptdata =
            var result = false;

            cancelBy = Utility.DEFAULTUSER;
            string message = string.Empty;

            try
            {
                //CBReceiptdata.CreatedBy = Utility.DEFAULTUSER;
                //CBReceiptdata.ModifiedBy = Utility.DEFAULTUSER;
                //CBReceiptdata.Source = "";
                result = new NetStock.BusinessFactory.CBReceiptBO().DeleteCBReceipt(documentNo, cancelBy);
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("Error", ex.Message);
            }

            return(Json(new { result = result, Message = "CBReceipt deleted successfully.", documentNo = documentNo }));

            //return RedirectToAction("CBReceipt", new { CBReceiptType = "", DocumentNo = CBReceiptdata.DocumentNo });
        }
Пример #7
0
        public ActionResult CBReceiptList()
        {
            var lstCBReceipt = new NetStock.BusinessFactory.CBReceiptBO().GetList().Where(x => x.IsCancel == false).ToList();

            return(View("CBReceiptList", lstCBReceipt));
        }