I am creating invoice generator. In that I want to store the total,discount and all things in my database. Total and discount are calculated as follow...
<tr ng-repeat="list in data">
<td>
<label class="clabel">Subtotal</label>
</td>
<td ng-model="subtotal">{{list.sale_price*list.quantity}}</td>
</tr>
<tr ng-repeat="list in data">
<td>
<label class="clabel">Tax(2%)</label>
</td>
<td ng-model="tax">{{((list.sale_price*list.quantity)*2)/100}}</td>
</tr>
<tr ng-repeat="list in data">
<td>
<label class="clabel">Discount(%)</label>
</td>
<td ng-model="discount">{{((list.sale_price*list.quantity)*list.discount)/100}}</td>
</tr>
<tr ng-repeat="list in data">
<td>
<label class="clabel">Total</label>
</td>
<td ng-model="total">{{((list.sale_price*list.quantity)+(((list.sale_price*list.quantity)*2)/100))-(((list.sale_price*list.quantity)*list.discount)/100)}}</td>
</tr>
<tr>
<td colspan="2">
<button class="btn btn-success" style="margin-left:400px;" ng-click="GenerateBill();updateAll()">Generate Invoice</button>
</td>
</tr>
Now I want to save the calculated values in my database.which means I want to store list.sale_price*list.quantity
's value.
js part is here..
$scope.updateAll = function(){
data={
qnt:$scope.qnt,
subt:$scope.subtotal,
tax:$scope.tax,
dis:$scope.discount,
total:$scope.total
}
$http.post("../POS_System/widget/updateAll.php?barcode="+$scope.barcode,data).success(function(data){
});
please help me out...