//
 // GET: /Accounting_Re_Verification/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
     db.Reject_Calculated_Tax(way_bill_id, 8, reject_reason_model.reason,"Accounting_Re_Verification");
     TempData["errorMessage"] = "Accounting Reverification Rejected";
     return RedirectToAction("Index");
 }
 //
 // GET: /Examination_Unit/Recheck_Manifest/W0009
 public ActionResult Recheck_Manifest(Reject_ReasonModel reject_reason_model)
 {
     var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
     db.Reject_Calculated_Tax(way_bill_id, 15, reject_reason_model.reason, "Examination_Unit_Recheck");
     EU_Check eu_check = new EU_Check();
     eu_check.way_bill_id = way_bill_id;
     eu_check.eu_checked_by = reject_reason_model.rechecked_by;
     eu_check.reject_number = 1; //1 represents recheck
     db.EU_Check.Add(eu_check);
     db.SaveChanges();
     TempData["errorMessage"] = "Examination Unit For Recheck";
     return RedirectToAction("Index");
 }
 //
 // GET: /Manifest_Control_Section/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
         var way_bill = (from w in db.Way_Bill
                         join i in db.Imports on w.import_id equals i.import_id
                         where w.way_bill_id == way_bill_id
                         select new { w.way_bill_id, i.import_id, w.way_bill_code }).First();
         Import import = db.Imports.Find(way_bill.import_id);
         import.importing_status_id = 13;
         db.Entry(import).State = EntityState.Modified;
         db.SaveChanges();
         Reject_Reason reject_reason = new Reject_Reason();
         reject_reason.way_bill_id = way_bill_id;
         reject_reason.reject_reason = reject_reason_model.reason;
         reject_reason.reject_from = "Manifest Control Section";
         reject_reason.rejected_date = DateTime.Now;
         db.Reject_Reason.Add(reject_reason);
         db.SaveChanges();
         TempData["errorMessage"] = "Manifest Control Section Rejected";
         return RedirectToAction("Index", new { way_bill_id = way_bill_id });
 }
 //
 // GET: /Manifest_Control_Section/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     if (Session["login_status"] != null)
     {
         int[] z = (int[])Session["function_id"];
         if (z.Contains(17))
         {
             var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
             var way_bill = (from w in db.Way_Bill
                             join i in db.Imports on w.import_id equals i.import_id
                             where w.way_bill_id == way_bill_id
                             select new { w.way_bill_id, i.import_id, w.way_bill_code }).First();
             Import import = db.Imports.Find(way_bill.import_id);
             import.importing_status_id = 13;
             db.Entry(import).State = EntityState.Modified;
             db.SaveChanges();
             Reject_Reason reject_reason = new Reject_Reason();
             reject_reason.way_bill_id = way_bill_id;
             reject_reason.reject_reason = reject_reason_model.reason;
             reject_reason.reject_from = "Manifest Control Section";
             reject_reason.rejected_date = DateTime.Now;
             db.Reject_Reason.Add(reject_reason);
             db.SaveChanges();
             TempData["errorMessage"] = "Manifest Control Section Rejected";
             return RedirectToAction("Index");
         }
         else
         {
             return RedirectToAction("../Home/Dashboard");
         }
     }
     else
     {
         return RedirectToAction("../Home");
     }
 }
 //
 // GET: /Compliance/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
     db.Reject_Calculated_Tax(way_bill_id, 12, reject_reason_model.reason, "Compliance");
     TempData["errorMessage"] = "Compliance Rejected";
     return RedirectToAction("Index");
 }
 //
 // GET: /Compliance/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     if (Session["login_status"] != null)
     {
         int[] z = (int[])Session["function_id"];
         if (z.Contains(19))
         {
             var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
             db.Reject_Calculated_Tax(way_bill_id, 12, reject_reason_model.reason, "Compliance");
             TempData["errorMessage"] = "Compliance Rejected";
             return RedirectToAction("Index");
         }
         else
         {
             return RedirectToAction("../Home/Dashboard");
         }
     }
     else
     {
         return RedirectToAction("../Home");
     }
 }
 //
 // GET: /Examination_Unit/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
     var import_status = (from i in db.Imports
                          where i.way_bill_id == way_bill_id
                          select i.importing_status_id).First();
     db.Reject_Calculated_Tax(way_bill_id, 17, reject_reason_model.reason, "Examination_Unit_Reject");
     EU_Check eu_check = new EU_Check();
     eu_check.way_bill_id = way_bill_id;
     eu_check.eu_checked_by = reject_reason_model.rechecked_by;
     if (import_status == 15)
     {
         eu_check.reject_number = 2; //2 represents reject after recheck
     }
     else if (import_status == 3)
     {
         eu_check.reject_number = 3; //3 represents direct reject
     }
     db.EU_Check.Add(eu_check);
     db.SaveChanges();
     TempData["errorMessage"] = "Examination Unit Rejected";
     return RedirectToAction("Index");
 }