public ActionResult DeleteInvoice(int id)
        {
            AcOPInvoiceDetail acopInvoiceD = entity.AcOPInvoiceDetails.Find(id);
            int acOPInvoiceMasterID        = acopInvoiceD.AcOPInvoiceMasterID.Value;
            int acjournalid = acopInvoiceD.AcJournalID.Value;

            entity.AcOPInvoiceDetails.Remove(acopInvoiceD);
            entity.SaveChanges();

            AcOPInvoiceMaster acOPInvoiceM = entity.AcOPInvoiceMasters.Find(acOPInvoiceMasterID);

            entity.AcOPInvoiceMasters.Remove(acOPInvoiceM);
            entity.SaveChanges();

            AcJournalMaster acJournalMaster = entity.AcJournalMasters.Find(acjournalid);

            entity.AcJournalMasters.Remove(acJournalMaster);
            entity.SaveChanges();

            AcJournalDetail acJournalD = entity.AcJournalDetails.Where(item => item.AcJournalID == acjournalid).FirstOrDefault();

            entity.AcJournalDetails.Remove(acJournalD);
            entity.SaveChanges();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteCustomerJournal( int id)
        {
            AcJournalDetail acJournalD = entity.AcJournalDetails.Find(id);
            int acjournalid = acJournalD.AcJournalID.Value;
            var data = entity.AcJournalDetails.Where(item => item.AcJournalID == acjournalid).ToList();
            foreach (var item in data)
            {
                entity.AcJournalDetails.Remove(item);
                entity.SaveChanges();
            }
           

            AcJournalMaster acJournalMaster = entity.AcJournalMasters.Find(acjournalid);
        entity.AcJournalMasters.Remove(acJournalMaster);
        entity.SaveChanges();

       
            
            return RedirectToAction("CustomerJList");
        }
Ejemplo n.º 3
0
        public ActionResult Create1(DebitNoteVM v)
        {
            AcJournalMaster ajm = new AcJournalMaster();

            int acjm = 0;

            acjm = (from c in db.AcJournalMasters orderby c.AcJournalID descending select c.AcJournalID).FirstOrDefault();

            ajm.AcJournalID = acjm + 1;

            ajm.AcCompanyID       = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
            ajm.AcFinancialYearID = Convert.ToInt32(Session["fyearid"].ToString());
            ajm.PaymentType       = 1;
            ajm.Remarks           = "Debit Note";
            ajm.StatusDelete      = false;
            ajm.TransDate         = v.Date;
            ajm.VoucherNo         = "DB-" + ajm.AcJournalID;
            ajm.TransType         = 1;
            ajm.VoucherType       = "";

            db.AcJournalMasters.Add(ajm);
            db.SaveChanges();


            AcJournalDetail a = new AcJournalDetail();

            int maxacj = 0;

            maxacj = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();

            a.AcJournalDetailID = maxacj + 1;

            a.AcJournalID = ajm.AcJournalID;
            a.AcHeadID    = v.AcHeadID;
            a.Amount      = v.Amount;
            a.BranchID    = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
            a.Remarks     = "";

            db.AcJournalDetails.Add(a);
            db.SaveChanges();


            AcJournalDetail b = new AcJournalDetail();

            maxacj = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();
            b.AcJournalDetailID = maxacj + 1;
            b.AcJournalID       = ajm.AcJournalID;
            b.AcHeadID          = v.AcHeadID;
            b.Amount            = -v.Amount;
            b.BranchID          = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
            b.Remarks           = "";



            db.AcJournalDetails.Add(b);
            db.SaveChanges();

            //var ids = (from x in db.PurchaseInvoiceDetails where x.PurchaseInvoiceID == v.InvoiceNo select (int?)x.PurchaseInvoiceDetailID).ToList();

            //int recpayid = (from c in db.RecPayDetails where ids.Contains(c.InvoiceID) select c.RecPayID).FirstOrDefault().Value;
            int recpayid = 0;
            int max      = 0;

            var data = (from c in db.DebitNotes orderby c.DebitNoteID descending select c).FirstOrDefault();

            if (data == null)
            {
                max = 1;
            }
            else
            {
                max = data.DebitNoteID + 1;
            }


            DebitNote d = new DebitNote();

            d.DebitNoteID   = max + 1;
            d.DebitNoteNo   = "D-" + (max + 1);
            d.InvoiceID     = v.InvoiceID;
            d.DebitNoteDate = v.Date;
            d.Amount        = v.Amount;
            d.AcJournalID   = ajm.AcJournalID;
            d.FYearID       = Convert.ToInt32(Session["fyearid"].ToString());
            d.AcCompanyID   = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
            d.RecPayID      = recpayid;
            d.AcHeadID      = v.AcHeadID;
            d.SupplierID    = v.SupplierID;
            d.InvoiceType   = "S";
            //d.IsShipping = true;
            d.Remarks = v.Remarks;
            db.DebitNotes.Add(d);
            db.SaveChanges();

            TempData["SuccessMsg"] = "Successfully Added Debit Note";
            return(RedirectToAction("List", "DebitNote"));
        }
Ejemplo n.º 4
0
        public ActionResult Create(DebitNoteVM v)
        {
            var             userid   = Convert.ToInt32(Session["UserID"]);
            int             BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            AcJournalMaster ajm      = new AcJournalMaster();
            int             fyearid  = Convert.ToInt32(Session["fyearid"].ToString());

            if (v.DebitNoteId > 0)
            {
                ajm = db.AcJournalMasters.Find(v.AcJournalID);
                var ajmd = db.AcJournalDetails.Where(cc => cc.AcJournalID == v.AcJournalID).ToList();
                db.AcJournalDetails.RemoveRange(ajmd);
                db.AcJournalMasters.Remove(ajm);
                db.SaveChanges();
                v.AcJournalID = 0;
            }
            if (v.AcJournalID == 0)
            {
                int acjm = 0;
                acjm = (from c in db.AcJournalMasters orderby c.AcJournalID descending select c.AcJournalID).FirstOrDefault();

                ajm.AcJournalID       = acjm + 1;
                ajm.AcCompanyID       = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
                ajm.BranchID          = Convert.ToInt32(Session["CurrentBranchID"].ToString());
                ajm.AcFinancialYearID = fyearid;
                ajm.PaymentType       = 1;
                var customer = db.SupplierMasters.Find(v.SupplierID).SupplierName;
                ajm.Remarks      = v.Remarks; // + " DN: for " + customer + " invoice : " + v.InvoiceNo;
                ajm.StatusDelete = false;
                ajm.VoucherNo    = AccountsDAO.GetMaxVoucherNo(v.TransType, fyearid);
                ajm.TransDate    = v.Date;
                ajm.TransType    = 1;
                ajm.VoucherType  = v.TransType;

                db.AcJournalMasters.Add(ajm);
                db.SaveChanges();
            }

            AcJournalDetail a = new AcJournalDetail();

            a = db.AcJournalDetails.Where(cc => cc.AcJournalID == ajm.AcJournalID && cc.Amount > 0).FirstOrDefault();
            if (a == null)
            {
                a = new AcJournalDetail();
                a.AcJournalDetailID = 0;
            }
            if (a.AcJournalDetailID == 0)
            {
                int maxacj = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();
                a.AcJournalDetailID = maxacj + 1;
                a.AcJournalID       = ajm.AcJournalID;
                //var customercon = db.AcHeads.Where(cc => cc.AcHead1 == "Supplier Control A/c ( Cr)").FirstOrDefault();
                a.AcHeadID = 337; //customercon.AcHeadID; ;
            }

            a.Amount   = v.Amount;
            a.BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString());
            a.Remarks  = v.Remarks;

            if (a.ID == 0)
            {
                db.AcJournalDetails.Add(a);
                db.SaveChanges();
            }
            else
            {
                db.Entry(a).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            foreach (var detail in v.Details)
            {
                AcJournalDetail b = new AcJournalDetail();
                b = db.AcJournalDetails.Where(cc => cc.AcJournalID == ajm.AcJournalID && cc.Amount < 0).FirstOrDefault();
                if (b == null)
                {
                    b = new AcJournalDetail();
                    b.AcJournalDetailID = 0;
                }
                if (b.AcJournalDetailID == 0)
                {
                    int maxacj = 0;
                    maxacj = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();

                    b.AcJournalDetailID = maxacj + 1;
                    b.AcJournalID       = ajm.AcJournalID;
                }
                b.AcHeadID = v.AcHeadID;
                if (v.TransType == "DN")
                {
                    b.Amount = -1 * detail.Amount;
                }
                else
                {
                    b.Amount = detail.Amount;
                }
                b.BranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString());
                b.Remarks  = detail.Remarks;
                if (b.ID == 0)
                {
                    db.AcJournalDetails.Add(b);
                    db.SaveChanges();
                }
                else
                {
                    db.Entry(b).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
            }


            DebitNote d = new DebitNote();

            if (v.DebitNoteId == 0)
            {
                int maxid = 0;

                var data = (from c in db.DebitNotes orderby c.DebitNoteID descending select c).FirstOrDefault();

                if (data == null)
                {
                    maxid = 1;
                }
                else
                {
                    maxid = data.DebitNoteID + 1;
                }
                d.CreatedBy   = userid;
                d.CreatedDate = CommanFunctions.GetCurrentDateTime();
                d.DebitNoteID = maxid;
                d.DebitNoteNo = AccountsDAO.GetMaxDebiteNoteNo(fyearid);
            }
            else
            {
                d = db.DebitNotes.Find(v.DebitNoteId);
                var det = db.DebitNoteDetails.Where(cc => cc.DebitNoteID == v.DebitNoteId).ToList();
                if (det != null)
                {
                    db.DebitNoteDetails.RemoveRange(det);
                    db.SaveChanges();
                }
            }


            d.InvoiceType = v.InvoiceType;
            d.TransType   = v.TransType;
            if (v.InvoiceID != 0)
            {
                if (v.TransType == "DN")
                {
                    d.InvoiceID = v.InvoiceID;
                }
                else
                {
                    d.RecPayID = v.InvoiceID;
                }
            }
            else
            {
                d.InvoiceID = 0;
            }
            d.DebitNoteDate = v.Date;
            d.Amount        = v.Amount;
            d.AcJournalID   = ajm.AcJournalID;
            d.FYearID       = Convert.ToInt32(Session["fyearid"].ToString());
            d.AcCompanyID   = Convert.ToInt32(Session["CurrentCompanyID"].ToString());
            d.BranchID      = Convert.ToInt32(Session["CurrentBranchID"].ToString());

            d.AcHeadID   = 527;;
            d.SupplierID = v.SupplierID;

            d.ModifiedBy   = userid;
            d.ModifiedDate = CommanFunctions.GetCurrentDateTime();
            d.Remarks      = v.Remarks;
            //d.IsShipping = true;
            if (v.DebitNoteId == 0)
            {
                db.DebitNotes.Add(d);
                db.SaveChanges();
                TempData["SuccessMsg"] = "Successfully Added Debit Note";
            }
            else
            {
                db.Entry(d).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                TempData["SuccessMsg"] = "Successfully Updated Debit Note";
            }
            foreach (var detail in v.Details)
            {
                DebitNoteDetail det = new DebitNoteDetail();
                det.AcHeadID    = detail.AcHeadID;
                det.Amount      = detail.Amount;
                det.Remarks     = detail.Remarks;
                det.DebitNoteID = d.DebitNoteID;
                db.DebitNoteDetails.Add(det);
                db.SaveChanges();
            }

            return(RedirectToAction("Index", "DebitNote"));
        }
Ejemplo n.º 5
0
        public ActionResult Create(DRSReceiptVM v)
        {
            DRSReceipt      tbl = new DRSReceipt();
            AcJournalMaster _AcJournalMaster = new AcJournalMaster();
            AcJournalDetail _AcJournalDetail = new AcJournalDetail();

            try
            {
                int max = (from c in db.DRSReceipts orderby c.DRSReceiptID descending select c.DRSReceiptID).FirstOrDefault();
                if (max == null)
                {
                    max = 1;
                }
                else
                {
                    max = max + 1;
                }



                tbl.DRSReceiptID = max;


                _AcJournalMaster.VoucherNo = tbl.DRSReceiptID.ToString();
                tbl.DRSNo          = v.DRSNo;
                tbl.EmployeeID     = v.EmployeeID;
                tbl.DRSReceiptDate = v.DRSReceiptDate;
                tbl.DepartmentID   = v.DepartmentID;
                tbl.VehicleID      = v.VehicleID;
                tbl.Amount         = v.Amount;
                tbl.Remarks        = v.Remarks;
                tbl.AcCompanyID    = Convert.ToInt32(Session["CurrenctCompanyID"].ToString());
                tbl.User1          = Convert.ToInt32(Session["UserID"].ToString());
                tbl.FYearID        = Convert.ToInt32(Session["fyearid"].ToString());

                db.DRSReceipts.Add(tbl);
                db.SaveChanges();

                int acjmax = (from c in db.AcJournalMasters orderby c.AcJournalID descending select c.AcJournalID).FirstOrDefault();
                if (acjmax == null)
                {
                    acjmax = 1;
                }
                else
                {
                    acjmax = acjmax + 1;
                }

                _AcJournalMaster.AcJournalID       = acjmax;
                _AcJournalMaster.TransDate         = v.DRSReceiptDate;
                _AcJournalMaster.AcFinancialYearID = Convert.ToInt32(Session["fyearid"].ToString());
                _AcJournalMaster.UserID            = Convert.ToInt32(Session["UserID"].ToString());
                _AcJournalMaster.AcCompanyID       = Convert.ToInt32(Session["CurrenctCompanyID"].ToString());

                _AcJournalMaster.Remarks      = v.Remarks;
                _AcJournalMaster.VoucherType  = "CI";
                _AcJournalMaster.TransType    = 1;
                _AcJournalMaster.StatusDelete = Convert.ToBoolean(0);
                db.AcJournalMasters.Add(_AcJournalMaster);
                db.SaveChanges();

                var DRSUpdate = (from a in db.DRSReceipts where a.DRSReceiptID == tbl.DRSReceiptID select a).FirstOrDefault();

                var id = (from a in db.AcJournalMasters orderby a.AcJournalID descending select a).FirstOrDefault();
                DRSUpdate.AcJournalID     = id.AcJournalID;
                db.Entry(DRSUpdate).State = EntityState.Modified;
                db.SaveChanges();


                int maxacjdid = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();
                if (maxacjdid == null)
                {
                    maxacjdid = 1;
                }
                else
                {
                    maxacjdid = maxacjdid + 1;
                }

                _AcJournalDetail.AcJournalDetailID = maxacjdid;
                _AcJournalDetail.AcJournalID       = id.AcJournalID;
                _AcJournalDetail.Amount            = v.Amount;
                _AcJournalDetail.Remarks           = v.Remarks;
                _AcJournalDetail.BranchID          = Convert.ToInt32(Session["CurrentBranchID"].ToString());

                db.AcJournalDetails.Add(_AcJournalDetail);
                db.SaveChanges();
                TempData["SuccessMsg"] = "You have successfully Added DRS Receipt.";

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
        public ActionResult Invoice(FormCollection formCollection, string Command, int id)
        {
            SalesInvoice SI = new SalesInvoice();

            //  UpdateModel<SalesInvoice>(SI);
            SI.SalesInvoiceID   = Common.ParseInt(formCollection["SalesInvoiceID"]);
            SI.SalesInvoiceNo   = (formCollection["SalesInvoiceNo"]);
            SI.SalesInvoiceDate = Common.ParseDate(formCollection["SalesInvoiceDate"]);
            SI.Reference        = (formCollection["Reference"]);
            SI.LPOReference     = (formCollection["LPOReference"]);
            SI.CustomerID       = Common.ParseInt(formCollection["SelectedCustomerID"]);
            //SI.EmployeeID = Common.ParseInt(formCollection["EmployeeeID"]);
            SI.EmployeeID   = Common.ParseInt(formCollection["SelectedEmployeeID"]);
            SI.CurrencyID   = Common.ParseInt(formCollection["SelectedCurrencyID"]);
            SI.ExchangeRate = Common.ParseDecimal(formCollection["ExchangeRate"]);
            SI.CreditDays   = 0;
            SI.DueDate      = Common.ParseDate(formCollection["DueDate"]);

            SI.BranchID          = Common.ParseInt(Session["branchid"].ToString());;
            SI.Discount          = 0;
            SI.StatusDiscountAmt = false;
            SI.OtherCharges      = 0;
            SI.PaymentTerm       = "";
            SI.Remarks           = (formCollection["Remarks"]);
            SI.FYearID           = Common.ParseInt(Session["fyearid"].ToString());
            SI.DeliveryId        = Common.ParseInt(formCollection["SelectedDeliveryId"]);
            SI.QuotationNumber   = (formCollection["QuotationNumber"]);
            SI.DiscountType      = Common.ParseInt(formCollection["DiscountType"]);
            SI.DiscountValueLC   = Common.ParseDecimal(formCollection["DiscountValueLC"]);
            SI.DiscountValueFC   = Common.ParseDecimal(formCollection["DiscountValueFC"]);

            BindAllMasters();
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }

            if (Command == "Save")
            {
                //SI.SalesInvoiceDate = System.DateTime.UtcNow;
                var context        = new SHIPPING_FinalEntities();
                var salesinvoiceId = (from c in context.SalesInvoices orderby c.SalesInvoiceID descending select c.SalesInvoiceID).FirstOrDefault();
                salesinvoiceId = salesinvoiceId + 1;
                var Gen_salesno = salesinvoiceId.ToString("00000");

                var salesNo = "SI-" + Gen_salesno;
                SI.SalesInvoiceNo = salesNo;
                int i = 0;
                SI.AcJournalID = 0;
                SI.IsShipping  = true;
                i = SM.AddSalesInvoice(SI);
                SI.SalesInvoiceID = i;
                DeleteAndInsertRecords(formCollection, i);

                AcJournalMaster acJournalMaster = new AcJournalMaster();
                acJournalMaster.AcFinancialYearID = Convert.ToInt32(Session["fyearid"].ToString());
                acJournalMaster.AcJournalID       = objectSourceModel.GetMaxNumberAcJournalMasters();
                acJournalMaster.VoucherType       = "SI";

                int max = (from c in context.AcJournalMasters select c).ToList().Count();

                acJournalMaster.VoucherNo    = salesNo; //(max + 1).ToString();
                acJournalMaster.UserID       = Convert.ToInt32(Session["UserID"].ToString());
                acJournalMaster.TransDate    = SI.SalesInvoiceDate;
                acJournalMaster.StatusDelete = false;
                acJournalMaster.ShiftID      = null;
                acJournalMaster.Remarks      = SI.Remarks;
                acJournalMaster.AcCompanyID  = Convert.ToInt32(Session["AcCompanyID"].ToString());
                acJournalMaster.Reference    = SI.Reference;
                context.AcJournalMasters.Add(acJournalMaster);
                context.SaveChanges();

                var acmasterid = acJournalMaster.AcJournalID;
                SI.AcJournalID = acmasterid;
                SM.UpdateSalesInvoice(SI);
                if (acmasterid > 0)
                {
                    DeleteorInsertAcJounalDetails(acmasterid, i);
                }
                if (i > 0)
                {
                    Session["SalesInvoiceID"] = i;
                    SI.SalesInvoiceID         = i;
                    //return RedirectToAction("Invoice", "SalesInvoice", new { ID = i });
                    return(RedirectToAction("Index", "SalesInvoice"));
                }
            }
            else if (Command == "Update")
            {
                SI.SalesInvoiceID = id;
                var salesinvoice = (from d in entity.SalesInvoices where d.SalesInvoiceID == id select d).FirstOrDefault();
                SI.AcJournalID = salesinvoice.AcJournalID;
                if (SI.AcJournalID == null)
                {
                    SI.AcJournalID = 0;
                }
                int k = SM.UpdateSalesInvoice(SI);
                DeleteAndInsertRecords(formCollection, id);
                if (SI.AcJournalID > 0)
                {
                    DeleteorInsertAcJounalDetails(SI.AcJournalID, id);
                }
                return(RedirectToAction("Index", "SalesInvoice"));

                //return RedirectToAction("Invoice", "SalesInvoice", new { ID = SI.SalesInvoiceID });
            }
            else if (Command == "SaveInvoice")
            {
            }
            return(RedirectToAction("Index", "SalesInvoice"));

            //return View(SI);
        }
        public JsonResult GetGridData(OpeningInvoiceVM obj)
        {
            bool drORcr = false;

            if (obj.DebitCreditID == true)
            {
                drORcr = true;
            }
            else

            {
                drORcr = false;
            }
            //Save data in acJournalMaster
            AcJournalMaster objACJournalMaster = new AcJournalMaster();

            objACJournalMaster.TransDate = DateTime.Now;

            objACJournalMaster.AcCompanyID       = Convert.ToInt32(Session["AcCompanyID"]);
            objACJournalMaster.AcFinancialYearID = Convert.ToInt32(Session["fyearid"]);
            objACJournalMaster.AcJournalID       = objectSourceModel.GetMaxNumberAcJournalMasters();;
            objACJournalMaster.VoucherNo         = "";
            objACJournalMaster.StatusDelete      = false;
            objACJournalMaster.VoucherType       = "";
            objACJournalMaster.Remarks           = obj.Remark;
            objACJournalMaster.VoucherNo         = "";
            if (obj.CustomerHeadId > 0)
            {
                objACJournalMaster.TransType = 1;
            }
            if (obj.SupplierHeadId > 0)
            {
                objACJournalMaster.TransType = 2;
            }
            objACJournalMaster.UserID = Convert.ToInt32(Session["UserID"]);
            objACJournalMaster.Lock   = false;

            entity.AcJournalMasters.Add(objACJournalMaster);
            entity.SaveChanges();

            //save data in acOpInvoiceMaster
            AcOPInvoiceMaster acOpMaster = new AcOPInvoiceMaster();
            int id = objectSourceModel.GetMaxNumberAcOpeningInvoiceMaster();

            if (id == 0)
            {
                acOpMaster.AcOPInvoiceMasterID = 1;
            }
            else
            {
                acOpMaster.AcOPInvoiceMasterID = objectSourceModel.GetMaxNumberAcOpeningInvoiceMaster();
            }
            acOpMaster.AcFinancialYearID = Convert.ToInt32(Session["fyearid"]);
            acOpMaster.OPDate            = obj.OPDate;
            if (obj.CustomerHeadId > 0)
            {
                acOpMaster.AcHeadID = obj.CustomerHeadId;
            }
            if (obj.SupplierHeadId > 0)
            {
                acOpMaster.AcHeadID = obj.SupplierHeadId;
            }

            // acOpMaster.PartyID=Convert.ToInt32( Session["AcCompanyID"]);
            acOpMaster.Remarks = obj.Remark;


            if (obj.SupplierHeadId > 0)
            {
                acOpMaster.PartyID = obj.SupplierHeadId;
            }
            else
            {
                acOpMaster.PartyID = obj.CustomerHeadId;
            }


            entity.AcOPInvoiceMasters.Add(acOpMaster);
            entity.SaveChanges();

            //save data in acJournalDetails
            //if (objACJournalMaster.AcJournalID > 0)
            //{
            //    var achead = objectSourceModel.GetAcHeadAssign();
            //    if (achead != null)
            //    {

            //        AcJournalDetail acJournalDetailsDR = new AcJournalDetail();

            //        acJournalDetailsDR.Amount = obj.InvoiceAmount;
            //        acJournalDetailsDR.Remarks = obj.Remark;
            //        acJournalDetailsDR.AcJournalID = objACJournalMaster.AcJournalID;
            //        acJournalDetailsDR.BranchID =Convert.ToInt32( Session["branchid"]);

            //        acJournalDetailsDR.AcJournalDetailID = objectSourceModel.GetMaxNumberAcJournalDetails();
            //        if (obj.CustomerHeadId != 0)
            //        {
            //            acJournalDetailsDR.AcHeadID = achead.CustomerControlAcID;
            //        }
            //        else
            //        {
            //            acJournalDetailsDR.AcHeadID = achead.SupplierControlAcID;
            //        }
            //        entity.AcJournalDetails.Add(acJournalDetailsDR);
            //        entity.SaveChanges();

            //        AcJournalDetail acJournalDetailsCR = new AcJournalDetail();

            //        acJournalDetailsCR.Amount = (-1) * Convert.ToDecimal(obj.InvoiceAmount);
            //        acJournalDetailsDR.Remarks = obj.Remark;
            //        acJournalDetailsDR.AcJournalID = objACJournalMaster.AcJournalID;
            //        acJournalDetailsDR.BranchID = Convert.ToInt32(Session["branchid"]);
            //        acJournalDetailsCR.AcJournalDetailID = objectSourceModel.GetMaxNumberAcJournalDetails();
            //        if (obj.CustomerHeadId != 0)
            //        {
            //            acJournalDetailsCR.AcHeadID = achead.CustomerControlAcID;
            //        }
            //        else
            //        {
            //            acJournalDetailsCR.AcHeadID = achead.SupplierControlAcID;
            //        }
            //        entity.AcJournalDetails.Add(acJournalDetailsCR);
            //        entity.SaveChanges();
            //    }
            //}

            return(new JsonResult
            {
                Data = new
                {
                    success = true,
                    AcJournalID = objACJournalMaster.AcJournalID,
                    AcOpeningMasterID = acOpMaster.AcOPInvoiceMasterID,
                    DebitOrCredit = drORcr
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
        public ActionResult Create(AWBillVM v)
        {
            try
            {
                string AWBNo = string.Empty;


                if (v.AWBNO != string.Empty)
                {
                    AWBNo = v.AWBNO;
                }
                else
                {
                    string aw = (from c in db.InScans orderby c.AWBNo descending select c.AWBNo).FirstOrDefault();

                    int a = Convert.ToInt32(aw) + 1;
                    AWBNo = a.ToString();
                }
                int CurrentBranchID = Convert.ToInt32(Session["CurrentBranchID"].ToString());
                var ahead           = db.AcHeadAssigns.FirstOrDefault(); // commented on sep 21 2020 Where(x => x.BranchID == CurrentBranchID).FirstOrDefault();
                try
                {
                    var ajm = new AcJournalMaster()
                    {
                        AcJournalID       = GetMaxAcJournalID() + 1,
                        VoucherNo         = "C.Note" + AWBNo,
                        TransDate         = DateTime.UtcNow,
                        AcFinancialYearID = Convert.ToInt32(Session["CurrentYear"].ToString()),
                        VoucherType       = "DX",
                        TransType         = 1,
                        StatusDelete      = false,
                        Remarks           = "",
                        UserID            = Convert.ToInt32(Session["UserID"].ToString()),
                        AcCompanyID       = Convert.ToInt32(Session["CurrenctCompanyID"].ToString()),
                        //BranchID = this.CurrentBranchID,
                        Reference = "",
                        ShiftID   = 0,
                    };
                    db.AcJournalMasters.Add(ajm);
                    db.SaveChanges();
                    if (v.paymentmode != "CSR" && v.TotalCharges > 0)
                    {
                        if (ahead != null)
                        {
                            int aheadassign = 0;

                            switch (v.paymentmode)
                            {
                            case "COD": aheadassign = ahead.CODControlID.Value; break;             //CODControlID

                            case "FOC": aheadassign = ahead.FOCControlID.Value; break;             //FOCControlID

                            case "PKP": aheadassign = ahead.ProvisionCostControlAcID.Value; break; //UnPostedSalesAcHeadID

                            default:
                                break;
                            }

                            if (aheadassign != 0 && Convert.ToDecimal(v.TotalCharges) != 0)
                            {
                                AcJournalDetail ajd = new AcJournalDetail()
                                {
                                    AcJournalDetailID = GetMaxAcJournalDetailID() + 1,
                                    AcJournalID       = ajm.AcJournalID,
                                    AcHeadID          = aheadassign,
                                    Amount            = Convert.ToDecimal(v.TotalCharges),
                                    Remarks           = "",
                                };
                                db.AcJournalDetails.Add(ajd);
                                db.SaveChanges();

                                ajd = new AcJournalDetail()
                                {
                                    AcJournalDetailID = GetMaxAcJournalDetailID() + 1,
                                    AcJournalID       = ajm.AcJournalID,
                                    AcHeadID          = aheadassign,
                                    Amount            = -Convert.ToDecimal(v.TotalCharges),
                                    Remarks           = "",
                                };
                                db.AcJournalDetails.Add(ajd);
                                db.SaveChanges();
                            }
                        }
                    }
                    else if (v.paymentmode == "CSR" && v.TotalCharges > 0)
                    {
                        AcJournalDetail ajd = new AcJournalDetail()
                        {
                            AcJournalDetailID = GetMaxAcJournalDetailID() + 1,
                            AcJournalID       = ajm.AcJournalID,
                            AcHeadID          = ahead.MaterialCostControlReceivableAcHeadID,
                            Amount            = Convert.ToDecimal(v.TotalCharges),
                            Remarks           = "",
                        };

                        db.AcJournalDetails.Add(ajd);
                        db.SaveChanges();

                        ajd = new AcJournalDetail()
                        {
                            AcJournalDetailID = GetMaxAcJournalDetailID() + 1,
                            AcJournalID       = ajm.AcJournalID,
                            AcHeadID          = ahead.MaterialCostControlReceivableAcHeadID,
                            Amount            = -Convert.ToDecimal(v.TotalCharges),
                            Remarks           = "",
                        };
                        db.AcJournalDetails.Add(ajd);
                        db.SaveChanges();
                    }

                    InScan inscan = new InScan();

                    inscan.InScanID = GetMaxInscanID();
                    //inscan.AWBNumberMode = IsAWBAutoManual;
                    inscan.BranchID         = Convert.ToInt32(Session["CurrentBranchID"].ToString());
                    inscan.AWBNo            = AWBNo;
                    inscan.Remarks          = v.Remarks;
                    inscan.UserID           = Convert.ToInt32(Session["UserID"].ToString());
                    inscan.EnquiryID        = 0;
                    inscan.StatusClose      = false;
                    inscan.MovementID       = v.movementID;
                    inscan.AcJournalID      = ajm.AcJournalID;
                    inscan.AcCompanyID      = Convert.ToInt32(Session["CurrenctCompanyID"].ToString());
                    inscan.StatusReconciled = false;
                    if (v.Date != null)
                    {
                        inscan.InScanDate = v.Date.Value;
                        //inscan.InScanDate = DateTime.Parse(deDate.SelectedDate.Value.Date.ToString("dd/MM/yyyy") + " " + deDate.SelectedDate.Value.ToString("HH:mm:ss")); //DateTime.Parse(deDate.SelectedDate.Value.Date.ToString("dd/MM/yyyy") + " " + this.rtpTime.SelectedDate.Value.ToString("HH:mm:ss")),
                    }

                    inscan.StatusInScan       = "CN";
                    inscan.CustomerRateTypeID = 0;
                    if (v.CustomerRateTypeID != null)
                    {
                        inscan.CustomerRateTypeID = v.CustomerRateTypeID;
                    }
                    inscan.Tax = 0;
                    if (v.Tax != null)
                    {
                        inscan.Tax = v.Tax;
                    }
                    if (v.Pieces != null)
                    {
                        inscan.Pieces = v.Pieces;
                    }
                    inscan.StatedWeight = 0;
                    if (v.Weight != null)
                    {
                        inscan.StatedWeight = v.Weight;
                    }
                    inscan.CourierDescriptionID = 0;
                    if (v.CourierType != null)
                    {
                        inscan.CourierDescriptionID = v.CourierType;
                    }

                    inscan.CourierServiceID = 0;
                    if (v.ProductType != null)
                    {
                        inscan.CourierServiceID = v.ProductType;
                    }


                    if (v.Agent != null)
                    {
                        inscan.IAgentID        = 0;
                        inscan.PickupCharges   = 0;
                        inscan.CollectedAmount = 0;
                        inscan.PickupCharges   = 0;
                        inscan.CollectedBy     = 0;
                        inscan.ReceivedBy      = 0;
                        if (v.Agent != null)
                        {
                            inscan.IAgentID = Convert.ToInt32(v.Agent);
                            if (v.collectedamt != null)
                            {
                                inscan.CollectedAmount = Convert.ToDecimal(v.collectedamt);
                            }
                            if (v.pickupcharge != null)
                            {
                                inscan.PickupCharges = Convert.ToDecimal(v.pickupcharge);
                            }
                        }
                    }
                    else
                    {
                        if (v.CollectedByDetails != null)
                        {
                            inscan.CollectedBy = v.CollectedByDetails;
                        }
                    }

                    inscan.ReceivedBy = 0;
                    if (v.ReceivedBy != null)
                    {
                        inscan.ReceivedBy = v.ReceivedBy;
                    }
                    inscan.CourierCharge = 0;
                    if (v.CourierCharges != null)
                    {
                        inscan.CourierCharge = v.CourierCharges;
                    }
                    inscan.OtherCharge = 0;
                    if (v.OtherCharges != null)
                    {
                        inscan.OtherCharge = v.OtherCharges;
                    }
                    inscan.ServiceCharge = 0;
                    if (v.ServiceCharges != null)
                    {
                        inscan.ServiceCharge = v.ServiceCharges;
                    }
                    inscan.PackingCharge = 0;
                    if (v.PackingCharges != null)
                    {
                        inscan.PackingCharge = v.PackingCharges;
                    }

                    if (v.paymentmode != null)
                    {
                        inscan.StatusPaymentMode = v.paymentmode;
                    }

                    inscan.OriginID = 0;
                    if (v.origincountry != null)
                    {
                        inscan.OriginID = v.origincountry;
                    }
                    if (v.destinationCountry != null)
                    {
                        inscan.DestinationID = v.destinationCountry.ToString();
                    }
                    inscan.ConsignorCityID = 0;
                    if (v.origincity != null)
                    {
                        inscan.ConsignorCityID = v.origincity;
                    }
                    inscan.ConsigneeCityID = 0;
                    if (v.destinationCity != null)
                    {
                        inscan.ConsigneeCityID = v.destinationCity;
                    }
                    if (v.CourierMode != null && v.CourierType != null)
                    {
                        inscan.TaxconfigurationID = (from tc1 in db.TaxConfigurations
                                                     where tc1.EffectFromDate <= DateTime.UtcNow && tc1.CourierMoveMentID == Convert.ToInt32(v.CourierMode) && tc1.ParcelTypeId == v.CourierType
                                                     select tc1.TaxConfigurationID).FirstOrDefault();
                    }
                    inscan.CustomerID = 0;
                    if (v.CustomerID != null)
                    {
                        inscan.CustomerID = v.CustomerID;
                    }

                    inscan.Consignee        = v.consignee;
                    inscan.Consignor        = v.shipper;
                    inscan.ConsigneeAddress = v.Consigneeaddress;
                    inscan.ConsignorAddress = v.shipperaddress;
                    if (v.ConsigneePhone != null)
                    {
                        inscan.ConsigneePhone = v.ConsigneePhone;
                    }
                    if (v.shipperphone != null)
                    {
                        inscan.ConsignorPhone = v.shipperphone;
                    }

                    inscan.ConsigneeCountryID = 0;
                    if (v.destinationCountry != null)
                    {
                        inscan.ConsigneeCountryID = v.destinationCountry;
                    }
                    inscan.ConsignorCountryID = 0;
                    if (v.origincountry != null)
                    {
                        inscan.ConsignorCountryID = v.origincountry;
                    }
                    if (v.originlocation != null)
                    {
                        inscan.ConsignorLocation = v.originlocation;
                    }
                    if (v.destinationLocation != null)
                    {
                        inscan.ConsigneeLocation = v.destinationLocation;
                    }

                    inscan.AcTaxJournalID = 0;
                    inscan.BalanceAmt     = 0;
                    if (v.TotalCharges != null)
                    {
                        inscan.BalanceAmt = v.TotalCharges;
                    }

                    inscan.TypeOfGoodID = 0;
                    if (v.InvoiceValue != null)
                    {
                        inscan.InvoiceValue = v.InvoiceValue;
                    }

                    inscan.MaterialCost = 0;
                    if (v.MaterialCost != null)
                    {
                        inscan.MaterialCost = v.MaterialCost;
                    }

                    inscan.ReferenceAWBNo      = v.ReferenceNumber;
                    inscan.MaterialDescription = v.MaterialDescription;
                    if (v.RevisedRate != null)
                    {
                        inscan.RevisedRate = v.RevisedRate;
                    }
                    if (v.SpecialInstructions != null)
                    {
                        inscan.SpecialInstructions = v.SpecialInstructions;
                    }
                    inscan.ConsigneeAddress1   = "";
                    inscan.ConsigneeAddress2   = "";
                    inscan.ConsignorAddress1   = "";
                    inscan.ConsignorAddress2   = "";
                    inscan.ConsigneeContact    = v.consigneecontact;
                    inscan.ConsignorContact    = v.consigneecontact;
                    inscan.CargoDescription    = v.CargoDescription;
                    inscan.HandlingInstruction = v.HandlingInstructions;

                    inscan.CustomsCollectedBy = 0;
                    if (v.ReceivedBy != null)
                    {
                        inscan.CustomsCollectedBy = v.ReceivedBy;
                    }
                    db.InScans.Add(inscan);
                    db.SaveChanges();


                    InScanInternationalDeatil isid = new InScanInternationalDeatil();


                    isid.InScanID = 0;
                    ////InScanInternationalDeatilID = Common.GetMaxNumber("InScanInternationalDeatilID", "InScanInternationalDeatils"),
                    isid.InScanID = inscan.InScanID;
                    ////InscanInternationalID = isi.InScanInternationalID,

                    isid.VerifiedWeight = 0;
                    if (v.VerifiedWeight != null)
                    {
                        isid.VerifiedWeight = Convert.ToDecimal(v.VerifiedWeight);
                    }
                    //if (txtForwardingCharge.Text != string.Empty)
                    //{
                    //    isid.ForwardingCharge = Convert.ToDecimal(txtForwardingCharge.Value);
                    //}

                    ////context.InScanInternationalDeatils.InsertOnSubmit(isid);


                    InScanInternational isi = new InScanInternational();

                    ////InScanInternationalID = Common.GetMaxNumber("InScanInternationalID", "InScanInternational"),
                    ////FAgentID = -1,

                    isi.FAgentID = 0;
                    if (v.ForwardingAgentID != null)
                    {
                        isi.FAgentID = v.ForwardingAgentID;
                    }
                    else
                    {
                        isi.FAgentID = 0;
                    }

                    if (v.ForwardingDate != null)
                    {
                        isi.ForwardingDate = v.ForwardingDate.Value;
                    }

                    isi.VerifiedWeight = 0;
                    if (v.VerifiedWeight != null)
                    {
                        isi.VerifiedWeight = v.VerifiedWeight;
                    }
                    //if (txtForwardingCharge.Text != string.Empty)
                    //{
                    //    isi.ForwardingCharge = Convert.ToDecimal(txtForwardingCharge.Value);
                    //}
                    isi.StatusAssignment       = false;
                    isi.ForwardingAWBNo        = v.ForwardingAWB;
                    isid.InscanInternationalID = isi.InScanInternationalID;
                    isi.InScanID = inscan.InScanID;
                    if (v.ForwardingAgentID != null)
                    {
                        isi.FAgentID = v.ForwardingAgentID;
                    }
                    if (v.ForwardingDate != null)
                    {
                        isi.ForwardingDate = v.ForwardingDate.Value;
                    }
                    db.InScanInternationals.Add(isi);
                    db.SaveChanges();

                    db.InScanInternationalDeatils.Add(isid);
                    db.SaveChanges();


                    int max = (from c in db.AWBStatus orderby c.AWBStatusID descending select c.AWBStatusID).FirstOrDefault();
                    if (max == null)
                    {
                        max = 1;
                    }
                    else
                    {
                        max = max + 1;
                    }

                    AWBStatu astat = new AWBStatu()
                    {
                        AWBStatusID         = max,
                        StatusDescriptionID = inscan.InScanID,
                        AWBNO  = AWBNo,
                        Date   = inscan.InScanDate,
                        Status = "DetailsUpdated",
                        FormID = "IN",
                    };

                    db.AWBStatus.Add(astat);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                }
            }
            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult Create(CreditNoteVM v)
        {
            AcJournalMaster ajm = new AcJournalMaster();

            int acjm = 0;

            acjm = (from c in db.AcJournalMasters orderby c.AcJournalID descending select c.AcJournalID).FirstOrDefault();

            ajm.AcJournalID       = acjm + 1;
            ajm.AcCompanyID       = Convert.ToInt32(Session["AcCompanyID"].ToString());
            ajm.AcFinancialYearID = Convert.ToInt32(Session["fyearid"].ToString());
            ajm.PaymentType       = 1;
            ajm.Remarks           = "Credit Note";
            ajm.StatusDelete      = false;
            ajm.TransDate         = v.Date;
            ajm.VoucherNo         = "C-" + ajm.AcJournalID;
            ajm.TransType         = 2;
            ajm.VoucherType       = "";

            db.AcJournalMasters.Add(ajm);
            db.SaveChanges();


            AcJournalDetail b = new AcJournalDetail();

            int maxacj = 0;

            maxacj = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();

            b.AcJournalDetailID = maxacj + 1;
            b.AcJournalID       = ajm.AcJournalID;
            b.AcHeadID          = v.AcHeadID;
            b.Amount            = -v.Amount;
            b.BranchID          = Convert.ToInt32(Session["AcCompanyID"].ToString());
            b.Remarks           = "";

            db.AcJournalDetails.Add(b);
            db.SaveChanges();


            AcJournalDetail a = new AcJournalDetail();

            maxacj = (from c in db.AcJournalDetails orderby c.AcJournalDetailID descending select c.AcJournalDetailID).FirstOrDefault();
            a.AcJournalDetailID = maxacj + 1;
            a.AcJournalID       = ajm.AcJournalID;
            a.AcHeadID          = v.AcHeadID;
            a.Amount            = v.Amount;
            a.BranchID          = Convert.ToInt32(Session["AcCompanyID"].ToString());
            a.Remarks           = "";



            db.AcJournalDetails.Add(a);
            db.SaveChanges();

            var invid    = 0;
            int?recpayid = 0;

            //if (v.TradingInvoice == false)
            //{
            //    int jobid = (from j in db.JobGenerations where j.JobCode == v.JobNO select j.JobID).FirstOrDefault();

            //     invid = (from c in db.JInvoices where c.JobID == jobid select c.InvoiceID).FirstOrDefault();


            //    var recpay = (from c in db.RecPayDetails where c.InvoiceID == invid select c).FirstOrDefault();
            //    if (recpay != null)
            //    {
            //        recpayid = recpay.RecPayID;
            //    }
            //}
            //else
            //{
            //    invid =Convert.ToInt32(v.JobNO);

            //  var  recpay = (from c in db.RecPayDetails where c.InvoiceID == invid select c).FirstOrDefault();
            //    if(recpay != null)
            //    {
            //        recpayid = recpay.RecPayID;
            //    }
            //}
            invid = Convert.ToInt32(v.JobNO);
            var ids = (from x in db.SalesInvoiceDetails where x.SalesInvoiceID == invid select(int?) x.SalesInvoiceDetailID).ToList();

            recpayid = (from c in db.RecPayDetails where ids.Contains(c.InvoiceID) select c.RecPayID).FirstOrDefault().Value;

            CreditNote d = new CreditNote();

            //int max = (from c in db.CreditNotes orderby c.CreditNoteNo descending select c.CreditNoteNo).FirstOrDefault().Value;
            int maxid = 0;

            var data = (from c in db.CreditNotes orderby c.CreditNoteID descending select c).FirstOrDefault();

            if (data == null)
            {
                maxid = 1;
            }
            else
            {
                maxid = data.CreditNoteID + 1;
            }

            d.CreditNoteID   = maxid;
            d.CreditNoteNo   = maxid;
            d.InvoiceID      = invid;
            d.CreditNoteDate = v.Date;
            d.Amount         = v.Amount;
            d.AcJournalID    = ajm.AcJournalID;
            d.FYearID        = Convert.ToInt32(Session["fyearid"].ToString());
            d.AcCompanyID    = Convert.ToInt32(Session["AcCompanyID"].ToString());
            d.RecPayID       = recpayid;
            d.AcHeadID       = v.AcHeadID;
            d.CustomerID     = v.CustomerID;
            d.statusclose    = false;
            d.InvoiceType    = "C";
            d.IsShipping     = true;

            db.CreditNotes.Add(d);
            db.SaveChanges();

            TempData["SuccessMsg"] = "Successfully Added Credit Note";
            return(RedirectToAction("Index", "CreditNote"));
        }
Ejemplo n.º 10
0
        public LargeJsonResult GetGridData(CustomerJournalVM cust)
        {
            AcJournalMaster objACJournalMaster = new AcJournalMaster();
            objACJournalMaster.TransDate = DateTime.Now;

            objACJournalMaster.AcCompanyID = Convert.ToInt32(Session["AcCompanyID"]);
            objACJournalMaster.AcFinancialYearID =Convert.ToInt32( Session["fyearid"]);
            objACJournalMaster.AcJournalID = objectSourceModel.GetMaxNumberAcJournalMasters(); ;
            objACJournalMaster.VoucherNo = "12345";
            objACJournalMaster.StatusDelete = false;
            objACJournalMaster.VoucherType = "";
            objACJournalMaster.Remarks = cust.Remark;
            if (cust.CustomerHeadId > 0)
            {
                objACJournalMaster.TransType = 1;
            }
            if (cust.SupplierHeadId > 0)
            {
                objACJournalMaster.TransType = 2;
            }
           
            objACJournalMaster.VoucherNo = "";
            entity.AcJournalMasters.Add(objACJournalMaster);
            entity.SaveChanges();

            if (objACJournalMaster.AcJournalID > 0)
            {
                var achead = objectSourceModel.GetAcHeadAssign();
                if (achead != null)
                {

                    AcJournalDetail acJournalDetailsDR = new AcJournalDetail();
                   
                        acJournalDetailsDR.Amount = Convert.ToDecimal(cust.amount);
                    acJournalDetailsDR.Remarks = cust.Remark;
                    acJournalDetailsDR.AcJournalID = objACJournalMaster.AcJournalID;
                    acJournalDetailsDR.AcJournalDetailID = objectSourceModel.GetMaxNumberAcJournalDetails();
                    if (cust.CustomerHeadId != 0)
                    {
                        acJournalDetailsDR.AcHeadID = achead.CustomerControlAcID;
                    }
                    else
                    {
                        acJournalDetailsDR.AcHeadID = achead.SupplierControlAcID;
                    }
                    entity.AcJournalDetails.Add(acJournalDetailsDR);
                    entity.SaveChanges();

                    AcJournalDetail acJournalDetailsCR = new AcJournalDetail();

                    acJournalDetailsCR.Amount = (-1) * Convert.ToDecimal(cust.amount);
                    acJournalDetailsCR.Remarks = cust.Remark;
                    acJournalDetailsCR.AcJournalID = objACJournalMaster.AcJournalID;
                    acJournalDetailsCR.AcJournalDetailID = objectSourceModel.GetMaxNumberAcJournalDetails();
                    if (cust.CustomerHeadId != 0)
                    {
                        acJournalDetailsCR.AcHeadID = achead.CustomerControlAcID;
                    }
                    else
                    {
                        acJournalDetailsCR.AcHeadID = achead.SupplierControlAcID;
                    }
                    entity.AcJournalDetails.Add(acJournalDetailsCR);
                    entity.SaveChanges();
                }
            }

            return new LargeJsonResult
            {
                MaxJsonLength=Int32.MaxValue,
                Data = new
                {
                    success = true,
                    AcJournalID = objACJournalMaster.AcJournalID
                  
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };


        }