public ActionResult Submit_Payment(int way_bill_id)
 {
     if (Session["login_status"] != null)
     {
         int[] z = (int[])Session["function_id"];
         if (z.Contains(34))
         {
             var grand_total_value = "";
             TempData["way_bill_id"] = way_bill_id;
             ViewBag.currency = new HomeController().Sos_Usd_Currency();
             ViewBag.payment_mode = new HomeController().Payment_Mode();
             var grand_total = db.E_Get_Grand_Total(way_bill_id, 100);
             foreach (var v in grand_total)
             {
                 grand_total_value = v;
             }
             E_Payment_details payment_deatils = new E_Payment_details();
             payment_deatils.amount_tobe_paid = grand_total_value;
             payment_deatils.currency_id_tobe_paid = 100;
             var payment_parts = db.E_Calculated_Payment_Config.Where(cpc => cpc.way_bill_id == way_bill_id).ToList();
             ViewBag.payment_partition = payment_parts;
             foreach (var item in payment_parts)
             {
                 payment_deatils.sos_part_total = item.calculated_sos_amount;
                 payment_deatils.usd_part_total = item.calculated_usd_amount;
                 TempData["sos"] = item.calculated_sos_part;
                 TempData["usd"] = item.calculated_usd_part;
             }
             return View(payment_deatils);
         }
         else
         {
             return RedirectToAction("../Home/Dashboard");
         }
     }
     else
     {
         return RedirectToAction("../Home");
     }
 }
 //
 // GET: /Payment_Export/Submit_Manifest/W0009
 public ActionResult Submit_Manifest(E_Payment_details payment_details, int way_bill_id, decimal sos, decimal usd)
 {
     if (Session["login_status"] != null)
     {
         int[] z = (int[])Session["function_id"];
         if (z.Contains(34))
         {
             if (((payment_details.sos_by_cash + payment_details.sos_by_cheque) != sos) || ((payment_details.usd_by_cash + payment_details.usd_by_cheque) != usd))
             {
                 TempData["errorMessage"] = "Payment Failed";
                 return RedirectToAction("Index");
             }
             else
             {
                 var export_id = (from e in db.Exports
                                  where e.e_way_bill_id == way_bill_id
                                  select e.export_id).First();
                 var payment_details_old = db.E_Payment_details.Where(pd => pd.import_id == export_id).ToList();
                 foreach (var item in payment_details_old)
                 {
                     db.E_Payment_details.Remove(item);
                 }
                 db.SaveChanges();
                 payment_details.paid_date = DateTime.Now;
                 payment_details.import_id = export_id;
                 db.E_Payment_details.Add(payment_details);
                 db.SaveChanges();
                 Export export = db.Exports.Find(export_id);
                 export.exporting_status_id = 28;
                 export.e_payment_id = 2;
                 db.Entry(export).State = EntityState.Modified;
                 db.SaveChanges();
                 TempData["errorMessage_payment"] = "Payment Submitted";
                 TempData["way_bill_id"] = way_bill_id;
                 //return RedirectToAction("Home_Print_Bolleto", "Home", new { currency_id = 100, way_bill_id = way_bill_id });
                 return RedirectToAction("Index");
             }
         }
         else
         {
             return RedirectToAction("../Home/Dashboard");
         }
     }
     else
     {
         return RedirectToAction("../Home");
     }
 }