*Hi*
*i try here to create and invoice as the
link: http://metaware.github.io/angular-invoicing/
<http://metaware.github.io/angular-invoicing/>*
*my project is MVC*
*every thing works fine but i have 2 problems:*
*1. can't get tax value in input of it in my view ?!*
*2. can't set invoice_sub_total and calculate_grand_total changeable while
i type Quantity or tax ?!*
*as you can see in above link while user type Quantity or tax the
**invoice_sub_total
and calculate_grand_total are changeable*
*so please how can i do that here ?*
*my html code:*
*@{ ViewBag.Title = "About";}<br /><div ng-app="jqanim"
ng-controller="InvoiceController"> <form method="post"
ng-submit="save(); item={}"> <table class="table table-bordered"
dir="rtl"> <tr> <td>إختر الصنف</td>
<td align="center"> <div>
@(Html.Kendo() .DropDownList()
.Name("ProductID")
.DataTextField("ProductName")
.DataValueField("ProductID") .Filter("contains")
.OptionLabel("حدد الصنف")
.HtmlAttributes(new { style = "width:350px", ng_model = "item.ProductID"
}) .Delay(1)
.AutoBind(true) .DataSource(source =>
{ source.Read(read =>
{
read.Action("GetProducts", "Home"); })
.ServerFiltering(true);
}) ) </div>
</td> <td align="center"> <input
class="text-center form-control" ng-model="item.Quantity" value="1"
size="4" ng:required ng:validate="integer" placeholder="Quantity"
style="width:100px;"> </td> <td
align="center"> <input class="text-center form-control"
ng-model="item.Discount" value="0.00" ng:required ng:validate="number"
size="6" placeholder="Discount" style="width:100px;"> </td>
<td class="text-center" style="vertical-align:middle;
width:100px;"> {{item.Discount * item.Quantity |
currency}} </td> <td align="center">
<input type="submit" name="submitbtn" value="Save" class="btn
btn-primary" /> </td> </tr> </table>
</form> <br /> @* Details *@ <table class="table table-striped"
align="center" dir="rtl"> <tr> <th
class="text-center">الصنف</th> <th
class="text-center">الكمية</th> <th
class="text-center">السعر</th> <th
class="text-center">الإجمالى</th> <th></th> </tr>
<tr ng-repeat="ord in orders"> <td align="center">
{{ord.ProductID }} </td> <td align="center">
{{ ord.Quantity}} </td> <td align="center">
{{ord.Discount }} </td> <td
class="text-center" style="vertical-align:middle">
{{ord.Discount * ord.Quantity | currency}} </td> <td
class="text-center"> <a href=""
ng-click="remove(ord.ProductID,$index)" class="btn btn-danger pull-right">
X </a> </td> </tr> </table> <br /> @* Totals *@
@* need to make this part changeable *@ <table class="table
table-striped" dir="ltr"> <tr> <td align="left"
style="width:150px;"> Sub Total </td>
<td align="left"> {{invoice_sub_total() | currency}}
</td> </tr> <tr> <td align="left"
style="width:150px;"> Tax(%): @* here i need
to get tax value from my angularjs model *@ <input
ng:model="ord.tax" ng:validate="number" style="background-color: #F9F9F9;
border: 1px solid #F9F9F9; width:43px;" class="text-center">
</td> <td align="left"> {{calculate_tax() |
currency}} </td> </tr> <tr> <td
align="left" style="width:150px;"> Grand Total:
</td> <td align="left"> {{calculate_grand_total()
| currency}} </td> </tr> </table></div><script
src="~/Scripts/angular.min.js"></script><script
src="~/Scripts/ang2.js"></script>my js code:*
*(function () { var app = angular.module('jqanim', []);
app.controller('InvoiceController', function ($scope, $http) {
$scope.tax = 13.00; $scope.save = function () {
$http.post("/api/customerService", $scope.item).success(function (data) {
$scope.orders.push(data); }); };
$scope.remove = function (id, index) {
$http.delete("/api/customerService?id=" + id).success(function (data) {
$scope.orders.splice(index, 1); }); };
$http.get("/api/CustomerService").success(function (data) {
$scope.orders = data; }); $scope.invoice_sub_total = function
() { var total = 0.00; angular.forEach($scope.orders,
function (item, key) { total += (item.Quantity *
item.Discount); }); return total; };
$scope.calculate_tax = function () { return (($scope.tax *
$scope.invoice_sub_total()) / 100); };
$scope.calculate_grand_total = function () {
localStorage["invoice"] = JSON.stringify($scope.orders); return
$scope.calculate_tax() + $scope.invoice_sub_total(); }; });})();*
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.