예제 #1
0
 public ActionResult GetQuotationDetails(int id)
 {
     EasyFreight.Models.QuotationView quoteView = QuotationHelper.GetOneQuote(id);
     ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList();
     ViewBag.QuoteContainers = QuotationHelper.GetQuotationContainers(id);
     return(PartialView("~/Views/Quotation/_MoreDetails.cshtml", quoteView));
 }
예제 #2
0
        public ActionResult PrintHBDetailsV(int houseBillId = 1033)
        {
            var hbView = HouseBillHelper.GetHBView(houseBillId);
            int id     = hbView.OperationId;

            EasyFreight.Models.OperationView quoteView = OperationHelper.GetOne(id);
            ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.QuoteContainers = OperationHelper.GetOperationContainers(id);
            ViewData["StaticText"]  = CommonHelper.GetStaticTextById(1);

            //if (quoteView.IsCareOf)
            //{
            //    CompanySetupVm company = CompanySetupHelper.GetCompanySetup();
            //    ViewBag.ShipperAddress = company.CompanyAddressEn;
            //    ViewBag.ShipperTel = (!string.IsNullOrEmpty(company.PhoneNumber1) ? " Tel. " + company.PhoneNumber1 : "") +
            //        (!string.IsNullOrEmpty(company.FaxNumber) ? "  Fax. " + company.FaxNumber : "");
            //}
            //else
            //{
            ViewBag.ShipperAddress = quoteView.ShipperAddressEn;
            ViewBag.ShipperTel     = (!string.IsNullOrEmpty(quoteView.ShipperPhoneNumber) ? " Tel. " + quoteView.ShipperPhoneNumber : "") +
                                     (!string.IsNullOrEmpty(quoteView.ShipperFaxNumber) ? " Fax. " + quoteView.ShipperPhoneNumber : "");
            //}



            return(View(hbView));
        }
예제 #3
0
        public ActionResult Add(int id = 0)
        {
            #region Check Rights
            bool hasRights;
            if (id == 0) //Check export rights
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ContractorRate, ActionEnum.Add);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ContractorRate, ActionEnum.Edit);
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home", new { area = "" }));
            }

            #endregion

            ContractorRateVm carrRateVm = ContractorRateHelper.GetContractorRateInfo(id);
            ViewBag.ContractorList   = ListCommonHelper.GetContractorList();
            ViewBag.ContainerList    = ListCommonHelper.GetContainerList();
            ViewData["AreaList"]     = ListCommonHelper.GetAreaGrouped();
            ViewData["CityList"]     = ListCommonHelper.GetCityGrouped();
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            return(View(carrRateVm));
        }
예제 #4
0
        public ActionResult AddInvoice(int hbId, int invId = 0)
        {
            ViewBag.PaymentTerm  = ListCommonHelper.GetPaymentTerm("en").Where(x => x.Key < 6).ToList();
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            var invObj = InvoiceHelper.GetInvoiceInfoNew(hbId, invId);

            return(View(invObj));
        }
예제 #5
0
        public ActionResult GetOtherTabForm(string tbName)
        {
            switch (tbName)
            {
            case "Shipper":
                ViewBag.TbName   = "Shipper";
                ViewBag.PkName   = "ShipperId";
                ViewBag.LibItems = ListCommonHelper.GetShipperList();
                break;

            case "Consignee":
                ViewBag.TbName   = "Consignee";
                ViewBag.PkName   = "ConsigneeId";
                ViewBag.LibItems = ListCommonHelper.GetConsigneeList();
                break;

            case "Carrier":
                ViewBag.TbName   = "Carrier";
                ViewBag.PkName   = "CarrierId";
                ViewBag.LibItems = ListCommonHelper.GetCarrierList();
                break;

            case "Contractor":
                ViewBag.TbName   = "Contractor";
                ViewBag.PkName   = "ContractorId";
                ViewBag.LibItems = ListCommonHelper.GetContractorList();
                break;

            case "Currency":
                ViewBag.TbName   = "Currency";
                ViewBag.PkName   = "CurrencyId";
                ViewBag.LibItems = ListCommonHelper.GetCurrencyList();
                break;

            case "BankAccount":
                ViewBag.TbName   = "BankAccount";
                ViewBag.PkName   = "BankAccId";
                ViewBag.LibItems = ListCommonHelper.GetBankAccList();
                break;

            case "PartnerAccount":
                ViewBag.TbName   = "AccountingChart";
                ViewBag.PkName   = "AccountId";
                ViewBag.LibItems = ListCommonHelper.GetPartnersList();
                break;

            case "CashDepositTempAccount":
                ViewBag.TbName   = "AccountingChart";
                ViewBag.PkName   = "AccountId";
                ViewBag.LibItems = ListCommonHelper.GetCCDepositList();
                break;
            }


            return(PartialView("~/Areas/MasterData/Views/OpenBalance/_AddBalanceMain.cshtml"));
        }
예제 #6
0
        public ActionResult ManageOrder(int id)
        {
            ViewBag.customClearObj = CustomClearanceHelper.GetOneCustClearView(id);
            CustomClearanceDetailMainVm custClearDetMain = CustomClearanceHelper.GetCustClearDetailList(id);

            ViewBag.CurrencyList   = ListCommonHelper.GetCurrencyList();
            ViewBag.CCCostNameList = ListCommonHelper.GetCustClearCostList();
            ViewBag.ccId           = id;
            return(View(custClearDetMain));
        }
예제 #7
0
        public ActionResult GetHBCost(int houseBillId, int operationId)
        {
            ViewBag.OperationCostNameList = ListCommonHelper.GetOperationCostList();
            ViewBag.CurrencyList          = ListCommonHelper.GetCurrencyList();
            ViewBag.HbObj       = ((List <HouseBillListVm>)TempData["hbList"]).Where(x => x.HouseBillId == houseBillId).FirstOrDefault();
            Session["hbOneObj"] = ((List <HouseBillListVm>)TempData["hbList"]).Where(x => x.HouseBillId == houseBillId).FirstOrDefault();
            OperationCostMainVm hbCostAdd = HouseBillHelper.GetHBCost(houseBillId, operationId);

            return(PartialView("~/Views/Operation/_OperationCost.cshtml", hbCostAdd));
        }
예제 #8
0
        public ActionResult AddOperationCost(int hbId)
        {
            ViewBag.OperationCostNameList = ListCommonHelper.GetOperationCostList();
            ViewBag.CurrencyList          = ListCommonHelper.GetCurrencyList();

            ViewBag.HbObj = HouseBillHelper.GetHbContent(hbId);
            // Session["hbOneObj"] = ((List<HouseBillListVm>)TempData["hbList"]).Where(x => x.HouseBillId == hbId).FirstOrDefault();

            OperationCostMainVm hbCostAdd = HouseBillHelper.GetHBCost(hbId);

            return(View(hbCostAdd));
        }
예제 #9
0
        public ActionResult CashInReceipt(int invId, int agNoteId = 0)
        {
            ViewBag.CashRecTitle = "Cash In Receipt";
            ViewBag.PaymentTerm  = ListCommonHelper.GetPaymentTerm("en", true)
                                   .Where(x => x.Key != 2 && x.Key < 6)
                                   .ToDictionary(x => x.Key, x => x.Value);
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            ViewBag.BankList     = ListCommonHelper.GetBankList();
            var cashReceiptObj = CashHelper.GetCashReceiptInfo(invId, agNoteId);

            return(View(cashReceiptObj));
        }
예제 #10
0
        public ActionResult CCCashDeposit(int operationId, decimal receiptAmount = 0)
        {
            ViewBag.PaymentTerm = ListCommonHelper.GetPaymentTerm("en")
                                  .Where(x => x.Key == 1)
                                  .ToDictionary(x => x.Key, x => x.Value);
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            ViewBag.BankList     = ListCommonHelper.GetBankList();
            var cashReceiptObj = CashOutHelper.GetCashReceiptInfo(0, 0, 0, operationId, receiptAmount);

            ViewBag.CashRecTitle = "Custom Clearance Cash Deposit For Operation " + cashReceiptObj.OperationCode;

            return(View("~/Views/CashManagement/CashInReceipt.cshtml", cashReceiptObj));
        }
예제 #11
0
        public ActionResult Add(int receiptId = 0)
        {
            ViewBag.PaymentTerm = ListCommonHelper.GetPaymentTerm("en")
                                  .Where(x => x.Key == 1)
                                  .ToDictionary(x => x.Key, x => x.Value);
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            ViewBag.BankList     = ListCommonHelper.GetBankList();
            var cashOutObj = CashOutExpenseHelper.GetCashReceiptForExpense(receiptId);

            ViewBag.ExpenseNameList = ListCommonHelper.GetExpensesLibraryList();
            ViewBag.ReceiptId       = receiptId;

            return(View(cashOutObj));
        }
예제 #12
0
        public ActionResult ArCashDeposit()
        {
            ViewBag.PaymentTerm = ListCommonHelper.GetPaymentTerm("en")
                                  .Where(x => x.Key == 1 || x.Key == 3) //Cash Or bank only
                                  .ToDictionary(x => x.Key, x => x.Value);
            ViewBag.CurrencyList  = ListCommonHelper.GetCurrencyList();
            ViewBag.BankList      = ListCommonHelper.GetBankList();
            ViewBag.ShipperList   = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList = ListCommonHelper.GetConsigneeList();

            var cashReceiptObj = CashHelper.GetCashReceiptInfo(0, 0);

            cashReceiptObj.Notes = "Cash Deposit From Client";
            return(View(cashReceiptObj));
        }
예제 #13
0
        public ActionResult Add(int id = 0, byte orderFrom = 1)
        {
            #region Check Rights
            bool hasRights;
            if (orderFrom == 1) //Check export rights
            {
                if (id == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportQuotation, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportQuotation, ActionEnum.Edit);
                }
            }
            else
            {
                if (id == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportQuotation, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportQuotation, ActionEnum.Edit);
                }
            }


            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home"));
            }
            #endregion

            QuotationVm quotationsVm = QuotationHelper.GetQuotationInfo(id, orderFrom);

            ViewBag.CarrierList      = ListCommonHelper.GetCarrierList("en", 1);
            ViewBag.ShipperList      = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList    = ListCommonHelper.GetConsigneeList();
            ViewBag.NotifierList     = ListCommonHelper.GetNotifierList(0);
            ViewBag.IncotermLib      = ListCommonHelper.GetIncotermLibList();
            ViewBag.Containers       = ListCommonHelper.GetContainerList();
            ViewData["PortList"]     = ListCommonHelper.GetPortsGrouped("en", 1);
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.AgentList        = ListCommonHelper.GetAgentList();

            return(View(quotationsVm));
        }
예제 #14
0
        /// <summary>
        /// Get house bill .. in case of no house bills .. will fill its view model from operation data
        /// </summary>
        /// <param name="operationId"> int Operation Id </param>
        /// <param name="oprOrderFrom">byte Order From</param>
        /// <returns></returns>
        public ActionResult GetHbContent(int operationId, byte oprOrderFrom, int hbId = 0)
        {
            #region Check Rights
            bool hasRights;
            if (oprOrderFrom == 1) //Check export rights
            {
                if (hbId == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportHB, ActionEnum.Edit);
                }
            }
            else
            {
                if (hbId == 0)
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.Add);
                }
                else
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportHB, ActionEnum.Edit);
                }
            }

            if (!hasRights)
            {
                return(PartialView("~/Views/Shared/_UnAuthorized.cshtml"));
            }

            #endregion
            HouseBillVm houseBillVm = HouseBillHelper.GetHbContent(operationId, oprOrderFrom, hbId);
            ViewBag.ShipperList      = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList    = ListCommonHelper.GetConsigneeList();
            ViewBag.IncotermLib      = ListCommonHelper.GetIncotermLibList();
            ViewBag.Containers       = ListCommonHelper.GetContainerList();
            ViewBag.PackageList      = ListCommonHelper.GetPackageTypeList();
            ViewData["PortList"]     = ListCommonHelper.GetPortsGrouped();
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.AgentList        = ListCommonHelper.GetAgentList();
            ViewBag.OperationVm      = OperationHelper.GetOperationInfo(operationId);
            ViewBag.OperContainers   = OperationHelper.GetOperationContainers(operationId);
            ViewBag.SelectedHbCon    = HouseBillHelper.GetHousContainerByHouseID(hbId);
            ViewBag.NotifierList     = ListCommonHelper.GetNotifierList(0);
            return(PartialView("~/Views/Operation/_HouseBill.cshtml", houseBillVm));
        }
예제 #15
0
        /// <summary>
        /// Get operation details for details pop-up
        /// </summary>
        /// <param name="id">Operation Id</param>
        /// <returns></returns>
        public ActionResult GetOperationDetails(int id)
        {
            Models.OperationView operationView = new Models.OperationView();
            if (TempData["OperationObj"] != null)
            {
                operationView = (Models.OperationView)TempData["OperationObj"];
            }
            else
            {
                operationView = OperationHelper.GetOne(id);
            }

            ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.OperContainers  = OperationHelper.GetOperationContainers(id);
            return(PartialView("~/Views/Operation/_MoreDetails.cshtml", operationView));
        }
예제 #16
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));
        }
예제 #17
0
        public ActionResult AddAgentNote(int operId, byte noteType, int agNoteId = 0)
        {
            if (noteType == 1)
            {
                ViewBag.NoteType = "Debit";
            }
            else
            {
                ViewBag.NoteType = "Credit";
            }

            ViewBag.BankList     = ListCommonHelper.GetBankList();
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();

            var agNoteVm = AgentNoteHelper.GetAgentNoteInfo(operId, noteType, agNoteId);

            return(View(agNoteVm));
        }
예제 #18
0
        public ActionResult CashOpenBalance(string accid, int cid)
        {
            ViewBag.PaymentTerm = ListCommonHelper.GetPaymentTerm("en", true)
                                  .Where(x => x.Key != 2 && x.Key < 6)
                                  .ToDictionary(x => x.Key, x => x.Value);

            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            ViewBag.BankList     = ListCommonHelper.GetBankList();

            var cashReceiptObj = CashHelper.GetCashReceiptOpenBalance(accid, cid);

            var openBalanceObject = AccountingHelper.Get_OpenBalanceObject(accid, cid);

            ViewBag.OpenBalanceObject = openBalanceObject;

            ViewBag.CashRecTitle = openBalanceObject.Amount < 0 ? "Cash Out Receipt" : "Cash In Receipt";

            return(View(cashReceiptObj));
        }
예제 #19
0
        public ActionResult ManageOrder(int id = 0)
        {
            var truckingOrderDetailVm = TruckingHelper.GetTruckingOrderDetailInfo(id);

            ViewBag.TruckingCostNameList = ListCommonHelper.GetTruckingCostNameList();
            ViewBag.CurrencyList         = ListCommonHelper.GetCurrencyList();
            ViewBag.ContractorList       = ListCommonHelper.GetContractorListByCity("en", truckingOrderDetailVm.FromCityId,
                                                                                    truckingOrderDetailVm.ToCityId);

            ViewBag.PackageList = ListCommonHelper.GetPackageTypeList();

            if (truckingOrderDetailVm.ContractorId != 0)
            {
                ViewBag.Contractorobj = ContractorHelper.GetContractorInfo(truckingOrderDetailVm.ContractorId).ContractorNameEn;
            }



            return(View(truckingOrderDetailVm));
        }
예제 #20
0
        /// <summary>
        /// The main view to process MBL .. it contains the all tabs
        /// </summary>
        /// <param name="orderFrom">export --- import</param>
        /// <param name="id">Operation Id</param>
        /// <returns>HouseBill with tabs</returns>
        public ActionResult HouseBill(string orderFrom, int id)
        {
            #region Check Rights
            bool hasRights;
            if (orderFrom.ToLower() == "export") //Check export rights
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportMBL, ActionEnum.ProcessToHB);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportMBL, ActionEnum.ProcessToHB);
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home"));
            }
            #endregion

            if (orderFrom.ToLower() == "export")
            {
                ViewBag.OperationType = "Export";
            }
            else if (orderFrom.ToLower() == "import")
            {
                ViewBag.OperationType = "Import";
            }
            else
            {
                //Error Page
            }


            EasyFreight.Models.OperationView operationView = OperationHelper.GetOne(id);
            TempData["OperationObj"] = operationView;
            ViewData["CurrecyList"]  = ListCommonHelper.GetCurrencyList();
            ViewBag.OperContainers   = OperationHelper.GetOperationContainers(id);
            ViewBag.HBCount          = HouseBillHelper.GetHBCount(id);
            //ViewBag.TruckingCount = TruckingHelper.GetTruckingOrdersCount(id);
            return(View(operationView));
        }
예제 #21
0
 public ActionResult GetShippingDeclaration(int id)
 {
     EasyFreight.Models.QuotationView quoteView = QuotationHelper.GetOneQuote(id);
     ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList();
     ViewBag.QuoteContainers = QuotationHelper.GetQuotationContainers(id);
     ViewData["StaticText"]  = CommonHelper.GetStaticTextById(1);
     Session["quoteId"]      = id;
     if (quoteView.IsCareOf)
     {
         CompanySetupVm company = CompanySetupHelper.GetCompanySetup();
         ViewBag.ShipperAddress = company.CompanyAddressEn;
         ViewBag.ShipperTel     = (!string.IsNullOrEmpty(company.PhoneNumber1) ? " Tel. " + company.PhoneNumber1 : "") +
                                  (!string.IsNullOrEmpty(company.FaxNumber) ? "  Fax. " + company.FaxNumber : "");
     }
     else
     {
         ViewBag.ShipperAddress = quoteView.ShipperAddressEn;
         ViewBag.ShipperTel     = (!string.IsNullOrEmpty(quoteView.ShipperPhoneNumber) ? " Tel. " + quoteView.ShipperPhoneNumber : "") +
                                  (!string.IsNullOrEmpty(quoteView.ShipperFaxNumber) ? " Fax. " + quoteView.ShipperPhoneNumber : "");
     }
     return(PartialView("~/Views/Quotation/_ShippingDecl.cshtml", quoteView));
 }
예제 #22
0
        public ActionResult PrintShippingDeclV(int id)
        {
            EasyFreight.Models.OperationView quoteView = OperationHelper.GetOne(id);
            ViewData["CurrecyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.QuoteContainers = OperationHelper.GetOperationContainers(id);
            ViewData["StaticText"]  = CommonHelper.GetStaticTextById(1);

            if (quoteView.IsCareOf)
            {
                CompanySetupVm company = CompanySetupHelper.GetCompanySetup();
                ViewBag.ShipperAddress = company.CompanyAddressEn;
                ViewBag.ShipperTel     = (!string.IsNullOrEmpty(company.PhoneNumber1) ? " Tel. " + company.PhoneNumber1 : "") +
                                         (!string.IsNullOrEmpty(company.FaxNumber) ? "  Fax. " + company.FaxNumber : "");
            }
            else
            {
                ViewBag.ShipperAddress = quoteView.ShipperAddressEn;
                ViewBag.ShipperTel     = (!string.IsNullOrEmpty(quoteView.ShipperPhoneNumber) ? " Tel. " + quoteView.ShipperPhoneNumber : "") +
                                         (!string.IsNullOrEmpty(quoteView.ShipperFaxNumber) ? " Fax. " + quoteView.ShipperPhoneNumber : "");
            }

            return(View(quoteView));
        }
예제 #23
0
        public ActionResult Add(int id = 0)
        {
            #region Check Rights
            bool hasRights;
            if (id == 0) //Check export rights
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.Bank, ActionEnum.Add);
            }
            else
            {
                hasRights = AdminHelper.CheckUserAction(ScreenEnum.Bank, ActionEnum.Edit);
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home", new { area = "" }));
            }

            #endregion
            BankVm bankVm = BankHelper.GetBankInfo(id);
            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            return(View(bankVm));
        }
        public ActionResult AddCashReceipt(string type)
        {
            if (type.ToLower() == "in")
            {
                ViewBag.CashRecTitle = "Cash In Receipt";
            }
            else if (type.ToLower() == "out")
            {
                ViewBag.CashRecTitle = "Cash out Receipt";
            }
            else
            {
                return(RedirectToAction("Index"));
            }

            ViewBag.PaymentTerm = ListCommonHelper.GetPaymentTerm("en").Where(x => x.Key < 6).ToList();

            ViewBag.CurrencyList = ListCommonHelper.GetCurrencyList();
            ViewBag.BankList     = ListCommonHelper.GetBankList();
            ViewBag.PartnersList = ListCommonHelper.GetPartnersList();
            var cashVm = PartnersDrawingHelper.GetCashReceiptForPartners(type);

            return(View(cashVm));
        }
예제 #25
0
 public ActionResult AdvSearch()
 {
     ViewBag.PaymentTerm = ListCommonHelper.GetPaymentTerm();
     ViewBag.Currency    = ListCommonHelper.GetCurrencyList();
     return(PartialView("~/Views/CashManagement/_AdvSearch.cshtml"));
 }
예제 #26
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));
        }
예제 #27
0
        /// <summary>
        /// Add export or import MBL operation
        /// </summary>
        /// <param name="orderFrom"> export --- import</param>
        /// <param name="id">operation id to load edit mode view</param>
        /// <param name="quoteId">quotation id in case of processing an exsiting quotation</param>
        /// <returns>the add operation view</returns>
        public ActionResult Add(string orderFrom = "export", int id = 0, int quoteId = 0)
        {
            #region Check Rights
            bool hasRights;
            if (orderFrom.ToLower() == "export") //Check export rights
            {
                if (quoteId != 0)                //process quotation check
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportQuotation, ActionEnum.ProcessToMBL);
                }
                else
                {
                    if (id == 0)
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportMBL, ActionEnum.Add);
                    }
                    else
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ExportMBL, ActionEnum.Edit);
                    }
                }
            }
            else
            {
                if (quoteId != 0) //process quotation check
                {
                    hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportQuotation, ActionEnum.ProcessToMBL);
                }
                else
                {
                    if (id == 0)
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportMBL, ActionEnum.Add);
                    }
                    else
                    {
                        hasRights = AdminHelper.CheckUserAction(ScreenEnum.ImportMBL, ActionEnum.Edit);
                    }
                }
            }

            if (!hasRights)
            {
                return(RedirectToAction("UnAuthorized", "Home"));
            }

            #endregion

            byte orderFromInt = 0;
            if (orderFrom.ToLower() == "export")
            {
                ViewBag.OperationType = "Export";
                orderFromInt          = 1;
            }
            else if (orderFrom.ToLower() == "import")
            {
                ViewBag.OperationType = "Import";
                orderFromInt          = 2;
            }
            else
            {
                //Error Page
            }


            OperationVm operationVm = OperationHelper.GetOperationInfo(id, orderFromInt, quoteId);

            ViewBag.CarrierList      = ListCommonHelper.GetCarrierList();
            ViewBag.ShipperList      = ListCommonHelper.GetShipperList();
            ViewBag.ConsigneeList    = ListCommonHelper.GetConsigneeList();
            ViewBag.NotifierList     = ListCommonHelper.GetNotifierList(0);
            ViewBag.IncotermLib      = ListCommonHelper.GetIncotermLibList();
            ViewBag.Containers       = ListCommonHelper.GetContainerList();
            ViewBag.PackageList      = ListCommonHelper.GetPackageTypeList();
            ViewData["PortList"]     = ListCommonHelper.GetPortsGrouped();
            ViewData["CurrencyList"] = ListCommonHelper.GetCurrencyList();
            ViewBag.AgentList        = ListCommonHelper.GetAgentList();

            return(View(operationVm));
        }