
Part-1: Point of Sale(POS) Inventory Super Shop Management System using ASP.NET MVC
Part-2: Point of Sale(POS) Setup template to your project | Super Shop Management System|ASP.NET MVC
Part-3: Point of Sale(POS) Database & table analysis | Super Shop Management System|ASP.NET MVC
Part-4: Point of Sale(POS) Database Create in SQL Server | Super Shop Management System|ASP.NET MVC
Part-5: Point of Sale(POS) Login using AJAX ASP.NET MVC | JQUERY
Part-6: Point of Sale(POS) Login and Authorization with Session variables in ASP.NET | JQUERY | AJAX
Part-7: Point of Sale(POS) Convert Password to MD5 Hash string in ASP.NET | Encrypt password in ASP.NET MVC C#
Part-8: Point of Sale(POS) Role based authentication and authorization in ASP.NET MVC|Redirect to not found page if not authorized|C#
Part-9: Point of Sale(POS) Create user & Account management UI UX in ASP.NET MVC
Part-10: Point of Sale(POS) User Creation & user registration using ASP.NET MVC | Jquery | Ajax
Part-11: Point of Sale(POS) Get user list using ASP.NET MVC | Jquery | Ajax
Part-12: Point of Sale(POS) Update user using ASP.NET MVC | Jquery | Ajax
Part-13: Inventory and POS Login logout session using ASP.NET | Supershop management system
Part-14: Inventory Category CRUD Create,Retrieve,Update,View | POS Category CRUD using ASP.NET JQuery AJAX
Part-15: Inventory and POS batch tracking and control table create in SQL Server 2012
Part-16: Inventory Product CRUD List | Point of sale Products Crud using asp.net MVC
Part-17: Inventory and POS Batch CRUD using asp.net MVC JQUERY AJAX | CSharp
Part-18: Inventory management and stock control using asp.net mvc | Jquery AngularJs
Part-19: Inventory & POS Stock edit and validation using asp.net AngularJS
POS 20: Inventory & POS AngularJS error fix
POS-21: Inventory & POS Invoice template setup using Bootstrap
POS-22: Invoice Adding input fields & adding rows Dynamically using Javascript | ASP.NET MVC | AngularJs
POS-23: Inventory Onclick get selected data & Calculate line total using Javascript ASP.NET MVC JQUERY
POS-24: Inventory Invoice Configuration and Calculation using JavaScript AngularJS ASP.NET MVC
POS-25: Inventory sale from invoice using ASP.NET MVC | Jquery AngularJS
POS-26: Get data using ASP.NET MVC AngularJS JQUERY
POS-27: Invoice sales page edit using ASP.NET MVC JQUERY AngularJS
POS-28: Invoice vat calculation discount calculation using Javascript ASP.NET MVC | Invoice crud asp.net
POS-29: Invoice calculate subtotal add row remove row using AngularJS ASP.NET MVC
Post your any code related problem to www.abctutorial.com
Go end of tutorial for Project Download
Follow the previous video and articles to complete the POS tutorials
Step-1:
- Remove the Comment-out of below code part from $scope.CalculateVat method and inside the HomeInvoiceListController.js part New version of this $scope.CalculateVat method will be below
$scope.CalculateVat = function () {
$scope.Sale.VatAmount = (($scope.Sale.Subtotal - $scope.Sale.DiscountAmount) * $scope.Sale.VatParcentage) / 100;
$scope.Sale.TotalAmount = ($scope.Sale.Subtotal - $scope.Sale.DiscountAmount) + $scope.Sale.VatAmount;
$scope.Sale.TotalAmout = ($scope.Sale.Subtotal - $scope.Sale.DiscountAmount) + $scope.Sale.VatAmount;
}
Step-2:
- If we click on the Plus(+) button then new row will be add so now we will add a method to do this.
$scope.AddNewRow = function () {
$scope.InvoiceCart.push({ ProductId: null, CategoryName: '', UnitPrice: 0, Quantity: 1, LineTotal: 0 });
}
- Add below methods to calculate subtotal and set value of products.
$scope.SetValueOfProduct = function (productId) {
var dataObj = $filter('filter')($scope.ProductList, { ProductId: parseInt(productId) })[0];
const index = $scope.InvoiceCart.findIndex((x) => x.ProductId === productId);
$scope.InvoiceCart[index].CategoryName = dataObj.CategoryName;
$scope.InvoiceCart[index].UnitPrice = dataObj.SalesPrice;
$scope.InvoiceCart[index].LineTotal = $scope.InvoiceCart[index].UnitPrice * $scope.InvoiceCart[index].Quantity;
}
$scope.SubTotalCalculation = function () {
$scope.Sale.Subtotal = 0;
for (var i = 0; i < $scope.InvoiceCart.length; i++) {
$scope.Sale.Subtotal = $scope.Sale.Subtotal + $scope.InvoiceCart[i].LineTotal;
}
}
- Add below method inside JavaScript to delete the row.
$scope.RowDelete = function (index,salesDetailId) {
if (index > -1) {
$scope.InvoiceCart.splice(index, 1);
}
$scope.SubTotalCalculation();
$scope.Deleted = []
$scope.Deleted.push(salesDetailId);
}
Step-3:
- Add this method inside the JavaScript to save update changes.
$scope.EditInvoice = function () {
var data = JSON.stringify({
sale: $scope.Sale, salesDetails: $scope.InvoiceCart, deleted: $scope.Deleted
});
return $.ajax({
contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: 'POST',
url: "/Home/EditInvoiceSale",
data: data,
success: function (result) {
if (result.IsSuccess == true) {
//Reset();
alert("Save Success!");
}
else {
alert("Save failed!");
}
},
error: function () {
alert("Error!")
}
});
}
- Add below method to HomeController for saving the update.
[HttpPost]
public JsonResult EditInvoiceSale(Sale sale, List<SalesDetail> salesDetails,List<int> deleted)
{
PointOfSale.Helper.AppHelper.ReturnMessage retMessage = new AppHelper.ReturnMessage();
POS_TutorialEntities db = new POS_TutorialEntities();
retMessage.IsSuccess = true;
if (deleted != null)
{
foreach (var item in deleted)
{
var data = db.SalesDetails.Where(x => x.SalesDetailId == item).SingleOrDefault(); ;
db.SalesDetails.Remove(data);
}
}
foreach (var item in salesDetails)
{
if (item.SalesDetailId > 0)
{
db.Entry(item).State = EntityState.Modified;
retMessage.Messagae = "Update Success!";
}
else
{
sale.SalesDetails.Add(new SalesDetail { ProductId = item.ProductId, UnitPrice = item.UnitPrice, Quantity = item.Quantity, LineTotal = item.LineTotal });
var prd = db.ProductStocks.Where(x => x.ProductId == item.ProductId && x.Quantity > 0).FirstOrDefault();
prd.Quantity = prd.Quantity - item.Quantity;
db.Entry(prd).State = EntityState.Modified;
db.Sales.Add(sale);
retMessage.Messagae = "Save Success!";
}
}
try
{
db.SaveChanges();
}
catch (Exception)
{
retMessage.IsSuccess = false;
}
return Json(retMessage, JsonRequestBehavior.AllowGet);
}
- Inside the Product listing table change the ng-click method by below
ng-click="RowDelete($index,cart.SalesDetailId)"
- Change ng-click save method by this
ng-click="EditInvoice()"
Step-4:
- Run the project