Last active
May 6, 2016 08:14
-
-
Save SimonDoy/4ca4c713da7b54201c204079fd484042 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
var invoiceControllersModule = angular.module('invoiceControllersModule', []); | |
invoiceControllersModule.controller('listInvoicesController', ['$scope', function ($scope) { | |
$scope.invoices = []; | |
$scope.error=""; | |
$scope.showInvoiceList=function(){ | |
return true; | |
}; | |
$scope.load = function(){ | |
var invoice=createInvoice(); | |
invoice.reference="INV01"; | |
invoice.companyName="Contoso"; | |
invoice.agencyContact="Jack Black"; | |
invoice.vatRate=20; | |
invoice.invoiceTotal=10000; | |
$scope.invoices.push(invoice); | |
invoice=createInvoice(); | |
invoice.reference="INV02"; | |
invoice.companyName="Fabrikam"; | |
invoice.agencyContact="Jack Black"; | |
invoice.vatRate=20; | |
invoice.invoiceTotal=10000; | |
$scope.invoices.push(invoice); | |
}; | |
$scope.load(); | |
function createInvoice(){ | |
var invoiceObject={ | |
reference: '', | |
companyName: '', | |
invoiceDate: '', | |
contact:'', | |
addressLine1:'', | |
addressLine2:'', | |
addressLine3:'', | |
addressLine4:'', | |
addressCity:'', | |
addressCounty:'', | |
addressPostCode:'', | |
addressCountry:'', | |
agencyName:'', | |
agencyContact: '', | |
invoiceLines: [ | |
], | |
invoiceTotal:0, | |
currencyType:'£', | |
vatRate:0, | |
vatAmount:0, | |
invoiceTotalWithVat:0, | |
status:'', | |
createdBy:'', | |
modifiedBy:'', | |
created:'', | |
modified:'', | |
}; | |
return invoiceObject; | |
}; | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment