Compare commits
No commits in common. "1ba8d2189aac06855dd9c757b13eceb4765c6dee" and "98edbe2d45c6dfddb6574324ea6b868e05ae8877" have entirely different histories.
1ba8d2189a
...
98edbe2d45
11 changed files with 12 additions and 138 deletions
|
@ -51,24 +51,6 @@
|
|||
{{( item.qty * item.cost ) | number : '1.02' | currency: order.currency.toUpperCase()}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="order.taxAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Sales Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.taxAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr *ngIf="order.vatAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Value-Added Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.vatAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr *ngIf="order.tipAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Tip</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.tipAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="invoice-title">
|
||||
<th width="55%"
|
||||
class="detailLineRight">
|
||||
|
|
|
@ -49,9 +49,6 @@ export class InvoiceComponent implements OnInit {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
|
|
@ -154,24 +154,6 @@
|
|||
width="30%">{{item.qty * item.cost | number:'1.02' | currency: order.currency.toUpperCase() }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tbdetail" *ngIf="order.taxAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Sales Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.taxAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="tbdetail" *ngIf="order.vatAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Value-Added Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.vatAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="tbdetail" *ngIf="order.tipAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Tip</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.tipAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="display: flex;
|
||||
|
|
|
@ -75,18 +75,6 @@
|
|||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="tax > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Sales Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ tax / 100 | percent:'1.2-4'}}</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ total * tax / 100 | currency: getCurrency() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr *ngIf="vat > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Value-Added Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ vat / 100 | percent:'1.2-4' }}</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ total * vat / 100 | currency: getCurrency() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -48,9 +48,6 @@ export class OrderComponent implements OnInit{
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
@ -61,13 +58,9 @@ export class OrderComponent implements OnInit{
|
|||
};
|
||||
public price: number = 1;
|
||||
public total: number = 0;
|
||||
public tax: number = 0;
|
||||
public vat: number = 0;
|
||||
public orderUpdate: Observable<Order>;
|
||||
public priceUpdate: Observable<number>;
|
||||
public totalUpdate: Observable<number>;
|
||||
public taxUpdate: Observable<number>;
|
||||
public vatUpdate: Observable<number>;
|
||||
|
||||
// ------------------------------------
|
||||
//
|
||||
|
@ -113,6 +106,9 @@ export class OrderComponent implements OnInit{
|
|||
this.orderUpdate = orderService.orderUpdate;
|
||||
this.orderUpdate.subscribe((order) => {
|
||||
this.order = order;
|
||||
|
||||
//console.log('this.order > ' + JSON.stringify(this.order));
|
||||
// ------------------------------------------------
|
||||
this.oLines = [];
|
||||
this.myLines = this.order.lines;
|
||||
var nl = {} as newLineItem;
|
||||
|
@ -138,14 +134,6 @@ export class OrderComponent implements OnInit{
|
|||
this.total = total;
|
||||
});
|
||||
|
||||
this.taxUpdate = orderService.taxUpdate;
|
||||
this.taxUpdate.subscribe((tax) => {
|
||||
this.tax = tax;
|
||||
});
|
||||
this.vatUpdate = orderService.vatUpdate;
|
||||
this.vatUpdate.subscribe((vat) => {
|
||||
this.vat = vat;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { LineItem } from '../items/lineitem.model';
|
||||
|
||||
export interface Order {
|
||||
_id?: string|null,
|
||||
_id?: string,
|
||||
address: string,
|
||||
session: string,
|
||||
timestamp?: string,
|
||||
|
@ -14,8 +14,5 @@ export interface Order {
|
|||
paid: boolean,
|
||||
externalInvoice: string,
|
||||
shortCode: string,
|
||||
token: string,
|
||||
taxAmount: number,
|
||||
vatAmount: number,
|
||||
tipAmount: number
|
||||
token: string
|
||||
}
|
||||
|
|
|
@ -57,9 +57,6 @@ export class OrderService {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
@ -75,10 +72,6 @@ export class OrderService {
|
|||
public readonly totalUpdate: Observable<number> = this._totalUpdated.asObservable();
|
||||
private _allOrdersUpdated: BehaviorSubject<Order[]> = new BehaviorSubject(this.dataStore.allOrders);
|
||||
public readonly allOrdersUpdate: Observable<Order[]> = this._allOrdersUpdated.asObservable();
|
||||
private _taxUpdated: BehaviorSubject<number> = new BehaviorSubject(this.dataStore.owner.taxValue);
|
||||
public readonly taxUpdate: Observable<number> = this._taxUpdated.asObservable();
|
||||
private _vatUpdated: BehaviorSubject<number> = new BehaviorSubject(this.dataStore.owner.vatValue);
|
||||
public readonly vatUpdate: Observable<number> = this._vatUpdated.asObservable();
|
||||
public userUpdate: Observable<User>;
|
||||
public ownerUpdate: Observable<Owner>;
|
||||
private reqHeaders: HttpHeaders;
|
||||
|
@ -102,16 +95,6 @@ export class OrderService {
|
|||
});
|
||||
this.ownerUpdate.subscribe((owner) => {
|
||||
this.dataStore.owner = owner;
|
||||
if (this.dataStore.owner.tax) {
|
||||
this._taxUpdated.next(Object.assign({}, this.dataStore).owner.taxValue);
|
||||
} else {
|
||||
this._taxUpdated.next(0);
|
||||
}
|
||||
if (this.dataStore.owner.vat) {
|
||||
this._vatUpdated.next(Object.assign({}, this.dataStore).owner.vatValue);
|
||||
} else {
|
||||
this._vatUpdated.next(0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -122,10 +105,10 @@ export class OrderService {
|
|||
if (OrderDataResponse.status == 200) {
|
||||
this.dataStore.order = OrderDataResponse.body!.order;
|
||||
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
||||
//this.dataStore.order.total = 0;
|
||||
//for(var line of this.dataStore.order.lines) {
|
||||
//this.dataStore.order.total += line.qty * line.cost;
|
||||
//}
|
||||
this.dataStore.order.total = 0;
|
||||
for(var line of this.dataStore.order.lines) {
|
||||
this.dataStore.order.total += line.qty * line.cost;
|
||||
}
|
||||
this._totalUpdated.next(Object.assign({}, this.dataStore).order.total);
|
||||
} else {
|
||||
console.log('No order found');
|
||||
|
@ -165,14 +148,6 @@ export class OrderService {
|
|||
}
|
||||
|
||||
createOrder(lineItem: LineItem) {
|
||||
let localTax = 0;
|
||||
let localVat = 0;
|
||||
if (this.dataStore.owner.tax) {
|
||||
localTax = lineItem.cost * lineItem.qty * this.dataStore.owner.taxValue / 100;
|
||||
}
|
||||
if (this.dataStore.owner.vat) {
|
||||
localVat = lineItem.cost * lineItem.qty * this.dataStore.owner.vatValue / 100;
|
||||
}
|
||||
var order:Order = {
|
||||
_id: '',
|
||||
address: this.dataStore.user.address,
|
||||
|
@ -187,13 +162,11 @@ export class OrderService {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: localTax,
|
||||
vatAmount: localVat,
|
||||
tipAmount: 0,
|
||||
lines: [lineItem]
|
||||
};
|
||||
let obs = this.http.post<{message: string, order: Order}>(this.beUrl+'api/order', {payload: order}, { headers: this.reqHeaders, params: this.reqParams });
|
||||
obs.subscribe((orderData) => {
|
||||
console.log('Created order');
|
||||
this.getOrder()
|
||||
});
|
||||
|
||||
|
@ -219,9 +192,6 @@ export class OrderService {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
@ -244,7 +214,7 @@ export class OrderService {
|
|||
this.dataStore.order.paid = paid;
|
||||
let obs = this.http.post(this.beUrl+'api/order', {payload: this.dataStore.order}, { headers: this.reqHeaders, params: this.reqParams });
|
||||
obs.subscribe((orderData) => {
|
||||
//console.log('Closed order', orderData);
|
||||
console.log('Closed order', orderData);
|
||||
this.dataStore.order = {
|
||||
address: '',
|
||||
session: '',
|
||||
|
@ -258,9 +228,6 @@ export class OrderService {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
|
|
@ -68,9 +68,6 @@ export class PmtserviceComponent implements OnInit {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
|
|
@ -47,9 +47,6 @@ export class ReceiptService {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
|
|
@ -51,24 +51,6 @@
|
|||
{{( item.qty * item.cost ) | number : '1.02' | currency: order.currency.toUpperCase()}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr *ngIf="order.taxAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Sales Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.taxAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr *ngIf="order.vatAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Value-Added Tax</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.vatAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr *ngIf="order.tipAmount > 0">
|
||||
<td class="newOrdertbdetail" style="text-align: right;">Tip</td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;"></td>
|
||||
<td class="newOrdertbdetail" style="text-align: right;">{{ order.tipAmount | currency: order.currency.toUpperCase() }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="invoice-title">
|
||||
<th width="55%"
|
||||
class="detailLineRight">
|
||||
|
|
|
@ -32,9 +32,6 @@ export class ReceiptComponent implements OnInit {
|
|||
externalInvoice: '',
|
||||
shortCode: '',
|
||||
token: '',
|
||||
taxAmount: 0,
|
||||
vatAmount: 0,
|
||||
tipAmount: 0,
|
||||
lines: [
|
||||
{
|
||||
qty: 1,
|
||||
|
|
Loading…
Reference in a new issue