Пример #1
0
        public ActionResult Delete(int invId, string deleteReason)
        {
            #region Check Rights
            bool hasRights = false;
            hasRights = AdminHelper.CheckUserAction(ScreenEnum.APInvoice, ActionEnum.Delete);
            if (!hasRights)
            {
                return(Json("You are UnAuthorized to do this action", JsonRequestBehavior.AllowGet));
            }

            #endregion

            string isDeleted = APInvoiceHelper.Delete(invId, deleteReason);
            return(Json(isDeleted, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult PrintInvoiceV(int id, int hbId, byte invFor, int operId)
        {
            InvoiceVm invObj;

            if (operId == 0)
            {
                invObj = APInvoiceHelper.GetInvoiceInfo(hbId, id, invFor, false); // old code .. will not happen
            }
            else
            {
                invObj = APInvoiceHelper.GetInvoiceInfoFullOperation(operId, id, invFor, false);
            }

            return(View("~/Views/Invoice/PrintInvoiceV.cshtml", invObj));
        }
Пример #3
0
        public ActionResult AddInvoice(int hbId, int operId = 0, int invId = 0, byte invFor = 1)
        {
            ViewBag.PaymentTerm  = ListCommonHelper.GetPaymentTerm("en").Where(x => x.Key < 6).ToList();
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            InvoiceVm invObj;

            if (operId == 0)
            {
                invObj = APInvoiceHelper.GetInvoiceInfo(hbId, invId, invFor); // old code .. will not happen
            }
            else
            {
                invObj = APInvoiceHelper.GetInvoiceInfoFullOperation(operId, invId, invFor);
            }
            return(View(invObj));
        }
Пример #4
0
        public ActionResult ViewInvoicePartial(int id, int hbId, byte invFor, int operId)
        {
            Session["invId"]  = id;
            Session["hbId"]   = hbId;
            Session["invFor"] = invFor;
            Session["operId"] = operId;

            InvoiceVm invObj;

            if (operId == 0)
            {
                invObj = APInvoiceHelper.GetInvoiceInfo(hbId, id, invFor, false); // old code .. will not happen
            }
            else
            {
                invObj = APInvoiceHelper.GetInvoiceInfoFullOperation(operId, id, invFor, false);
            }

            return(PartialView("~/Views/Invoice/_ViewInvoice.cshtml", invObj));
        }
Пример #5
0
        public ActionResult GetAPInvoiceTab(int operId)
        {
            var agNoteList = APInvoiceHelper.GetInvoiceListForOper(operId);

            return(PartialView("~/Views/Accounting/_APInvListForOper.cshtml", agNoteList));
        }
Пример #6
0
        public PartialViewResult GetCCCashDepositList(int operId)
        {
            var ccCashDepList = CashOutHelper.GetCCCashDepositList(operId);

            if (ccCashDepList.Count > 0)
            {
                Dictionary <string, decimal> DepositTotals = new Dictionary <string, decimal>();

                var DepositTotalsObj = ccCashDepList.GroupBy(x => x.CurrencySign)
                                       .Select(x => new { curr = x.Key, total = x.Sum(y => y.ReceiptAmount.Value) }).ToList();

                //Get any collcted back deposits
                var     depositSattl = CashHelper.GetCashSettlementForOper(operId);
                decimal depositAmout = 0;
                if (depositSattl != null)
                {
                    foreach (var item in DepositTotalsObj)
                    {
                        if (depositSattl.Keys.Contains(item.curr))
                        {
                            depositAmout = item.total - depositSattl[item.curr];
                        }
                        else
                        {
                            depositAmout = item.total;
                        }

                        DepositTotals.Add(item.curr, depositAmout);
                    }
                }

                ViewBag.DepositTotal = DepositTotals;
                //ViewBag.Currency = ccCashDepList.FirstOrDefault().CurrencySign;
            }
            else
            {
                ViewBag.DepositTotal = 0;
                ViewBag.Currency     = "EGP";
            }
            //Get AP invoices
            var apInvList = APInvoiceHelper.GetInvoiceListForOper(operId);

            if (apInvList.Count > 0)
            {
                var currList    = ListCommonHelper.GetCurrencyList();
                var apInvTotals = apInvList.Where(x => x.InvoiceType == 3).GroupBy(x => x.InvCurrencyId)
                                  .Select(x => new { curr = x.Key, total = x.Sum(y => y.InvoiceDetails.Sum(c => c.InvoiceAmount)) });

                Dictionary <string, decimal> apInvTotalsDic = new Dictionary <string, decimal>();
                string currSign = "";

                foreach (var item in apInvTotals)
                {
                    currSign = currList.Where(x => x.Key == item.curr).FirstOrDefault().Value;
                    apInvTotalsDic.Add(currSign, item.total);
                }

                ViewBag.CCInvTotal = apInvTotalsDic;
            }
            else
            {
                ViewBag.CCInvTotal = 0;
            }

            ViewBag.OperId = operId;

            var cashSettlement = CashHelper.GetCashSettlementForOper(operId);

            // if(cashSettlement.Count > 0)
            ViewBag.CashSettlement = cashSettlement;


            return(PartialView("~/Views/CashDeposit/_CCCashDepositList.cshtml", ccCashDepList));
        }
Пример #7
0
        public ActionResult AddEditInvoice(InvoiceVm invoiceVm)
        {
            string isSaved = APInvoiceHelper.AddEditInvoice(invoiceVm);

            return(Json(isSaved));
        }
Пример #8
0
        public JObject GetTableJson(FormCollection form)
        {
            JObject quotationOrders = APInvoiceHelper.GetInvListJson(form);

            return(quotationOrders);
        }
Пример #9
0
        public ActionResult ViewInvoice(int id, int hbId, byte invFor, int operId = 0)
        {
            InvoiceVm invObj = APInvoiceHelper.GetInvoiceInfoFullOperation(operId, id, invFor, false);

            return(View("~/Views/Invoice/ViewInvoice.cshtml", invObj));
        }