コード例 #1
0
        public ActionResult loadBillingLinesEdit(BillingModels model)
        {
            var lines = _allBilling.BillingLineDetailsGetByAll(Convert.ToInt64(model.UniqueID));

            model.BillLines = lines;
            return(View("~/Views/Billing/PartialViews/_loadDynamicBillLinePartialView.cshtml", model));
        }
コード例 #2
0
        public ActionResult Index()
        {
            var model = new BillingModels();

            model.Line = new BillingLineModels();
            return(View(model));
        }
コード例 #3
0
        public ActionResult PrintBill(long UniqueID)
        {
            var model = new BillingModels();

            model.UniqueID = UniqueID;
            return(View(model));
        }
コード例 #4
0
        public ActionResult AddBillingDetails(BillingModels model)
        {
            model.IsActive  = true;
            model.CreatedBy = SessionWrapper.User.UniqueID;
            var result = _allBilling.BillingDetailsInsertUpdateDelete(model);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
 public ActionResult loadBillingLinesView(BillingModels model)
 {
     if (model.BillLines == null)
     {
         model.BillLines = new List <BillingLineModels>();
     }
     model.BillLines.Add(new BillingLineModels()
     {
         DescriptionOfGoods = "", Description = "", HSNCode = "", Quantity = 0, Unit = "", Rate = 0
     });
     return(View("~/Views/Billing/PartialViews/_loadDynamicBillLinePartialView.cshtml", model));
 }
コード例 #6
0
        public ActionResult PopulateBillingItems(BillingModels model)
        {
            if (model.BillLines == null)
            {
                model.BillLines = new List <BillingLineModels>();
            }
            var line = new BillingLineModels();

            line.DescriptionOfGoods = model.Line.DescriptionOfGoods;
            line.Description        = model.Line.Description;
            line.HSNCode            = model.Line.HSNCode;
            line.Quantity           = model.Line.Quantity;
            line.Unit = model.Line.Unit;
            line.Rate = model.Line.Rate;
            model.BillLines.Add(line);
            return(View("~/Views/Billing/PartialViews/_loadBillLinePartialView.cshtml", model));
        }
コード例 #7
0
        public string BillingDetailsInsertUpdateDelete(BillingModels mode)
        {
            decimal TotalValue     = 0;
            decimal LoadingCharges = 0;
            decimal TaxableAmount  = 0;
            decimal CGST           = 0;
            decimal SGST           = 0;
            decimal IGST           = 0;
            long    GrandTotal     = 0;

            if (mode.UniqueID > 0)
            {
                mode.ActionId = 1;
            }
            object[] objParamBill = { mode.ActionId,        mode.UniqueID,          "",                     mode.CompanyUniqueID,  mode.ClientUniqueID,  mode.BillingAddress, mode.BillingStateCode, mode.BillingStateName, mode.BillingCityName, mode.BillingPinCode,
                                      mode.ShippingAddress, mode.ShippingStateCode, mode.ShippingStateName, mode.ShippingCityName, mode.ShippingPinCode, DateTime.Now,        mode.ModeOfTransport,  mode.VehicleNumber,    mode.PlaceOfSupply
                                      ,                     mode.FreightCharge,     mode.BillTypeID,        mode.GSTTypeID,        mode.IsActive,        mode.CreatedBy };
            var      d = SqlHelper.ExecuteScalar(db.GetConnection(), Procedures.BillingDetailsInsertUpdateDelete, objParamBill);

            if (Convert.ToInt64(d) > 0)
            {
                foreach (var v in mode.BillLines)
                {
                    TotalValue = TotalValue + (v.Quantity * v.Rate);
                    if (v.UniqueID > 0)
                    {
                        mode.ActionId = v.UniqueID;
                        object[] objParamLines = { mode.ActionId, mode.UniqueID, Convert.ToInt64(d), v.DescriptionOfGoods, v.Description, v.HSNCode, v.Quantity, v.Unit
                                                   ,              v.Rate,        !v.IsActive,        mode.CreatedBy };
                        var      line = SqlHelper.ExecuteScalar(db.GetConnection(), Procedures.BillingLineDetailsInsertUpdateDelete, objParamLines);
                    }
                    else
                    {
                        if (!v.IsActive)
                        {
                            mode.ActionId = 0;
                            object[] objParamLines = { mode.ActionId, mode.UniqueID, Convert.ToInt64(d), v.DescriptionOfGoods, v.Description, v.HSNCode, v.Quantity, v.Unit
                                                       ,              v.Rate,        !v.IsActive,        mode.CreatedBy };
                            var      line = SqlHelper.ExecuteScalar(db.GetConnection(), Procedures.BillingLineDetailsInsertUpdateDelete, objParamLines);
                        }
                    }
                }

                TaxableAmount = TotalValue + mode.FreightCharge;
                string values = CalculateTotalValues(TaxableAmount);
                if (mode.GSTTypeID == 1)
                {
                    CGST       = Convert.ToDecimal(values.Split('$')[0]);
                    SGST       = Convert.ToDecimal(values.Split('$')[1]);
                    IGST       = 0;
                    GrandTotal = Convert.ToInt64(Math.Round((Convert.ToDecimal(values.Split('$')[0]) + Convert.ToDecimal(values.Split('$')[1]) + Convert.ToDecimal(values.Split('$')[3])), 0));
                }
                else
                {
                    CGST       = 0;
                    SGST       = 0;
                    IGST       = Convert.ToDecimal(values.Split('$')[2]);
                    GrandTotal = Convert.ToInt64(Math.Round((Convert.ToDecimal(values.Split('$')[2]) + Convert.ToDecimal(values.Split('$')[3])), 0));
                }
                CalculateTotalValuesUpdate(Convert.ToInt64(d), LoadingCharges, TaxableAmount, CGST, SGST, IGST, 0, 0, GrandTotal);
            }
            return(Convert.ToString(d));
        }