private string GetTotalExpenseDueAmount(int partyId, int bookingId = 0)
        {
            string dbContextConnectionString = ConfigurationHelper.GetsmARTDBContextConnectionString();
            ExpensesRequestLibrary lib       = new ExpensesRequestLibrary();

            lib.Initialize(dbContextConnectionString);
            return(lib.GetTotalDueAmount(partyId, bookingId).ToString());
        }
        public ActionResult GetUnPaidExpenses(GridCommand command, string partyId, string bookingId = "0")
        {
            TempEntityList.Clear();

            if (Convert.ToInt32(partyId) > 0)
            {
                string dbContextConnectionString = ConfigurationHelper.GetsmARTDBContextConnectionString();
                ExpensesRequestLibrary lib       = new ExpensesRequestLibrary();
                lib.Initialize(dbContextConnectionString);
                IEnumerable <ExpensesRequest> results = lib.GetUnPaidExpenses(new string[] { "Paid_Party_To", "Scale_Ref", "Dispatcher_Request_Ref.Booking_Ref_No", "Dispatcher_Request_Ref.Container" },
                                                                              int.Parse(partyId), int.Parse(bookingId)
                                                                              );
                if (results != null && results.Count() > 0)
                {
                    PaymentReceiptDetails paymentDetails;
                    int id = 0;
                    foreach (var item in results)
                    {
                        id            += 1;
                        paymentDetails = new PaymentReceiptDetails()
                        {
                            ID             = id,
                            ExpenseRequest = item,
                            Balance_Amount = Convert.ToDecimal(item.Amount_Paid - item.Amount_Paid_Till_Date),
                            PaymentReceipt = new PaymentReceipt()
                        };
                        if (paymentDetails.Settlement != null)
                        {
                            paymentDetails.Settlement.Scale = null;
                        }
                        if (paymentDetails.ExpenseRequest.Dispatcher_Request_Ref != null)
                        {
                            paymentDetails.ExpenseRequest.Dispatcher_Request_Ref.TruckingCompany = null;
                        }
                        TempEntityList.Add(paymentDetails);
                    }
                }
            }
            return(Display(command, "0", true));
        }