Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 | 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 40x 40x 40x 40x 21x 1x 21x 9x 9x 2x 9x 1x 9x 9x 9x 9x 9x 9x 9x 1x 9x 9x 8x 1x 1x 1x 9x 1x 9x 43x 43x 43x 11x 32x 43x 2x 43x 5x 38x 29x 5x 3x 3x 3x 3x 5x 9x 1x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 9x 1x 9x 9x 9x 9x 8x 8x 8x 1x 1x 1x 1x 9x 9x 9x 9x 9x 1x 37x 35x 2x 35x 35x 35x 24x 22x 2x 24x 8x 8x 1x 1x 2x 1x 1x 34x 34x 34x 32x 2x 32x 1x 31x 2x 2x 2x 2x 2x 32x 1x 31x 2x 2x 2x 2x 2x 8x 30x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 9x 3x 3x 3x 3x 3x 3x 3x 3x 9x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 8x | import { ViewType, ViewObject } from '../base';
import { Subject } from 'rxjs';
import { AppConstants } from '@unpispas/upp-defs';
import { PriceType, PriceInfo } from '@unpispas/upp-defs';
import { SerialType, InvoiceType } from './place';
import { dataService, dataTransaction } from '../../data';
import { toastService } from '@unpispas/upp-base';
import { languageService } from '@unpispas/upp-base';
import { TicketPayment } from '../objects/ticket';
import { TicketChangeReason } from '../objects/ticketchange';
import { Ticket } from '../objects/ticket';
import { TicketProduct } from '../objects/ticketproduct';
import { TicketOption } from '../objects/ticketoption';
import { TicketOffer } from '../objects/ticketoffer';
import { TicketExtra } from '../objects/ticketextra';
import { TicketDiscount } from '../objects/ticketdiscount';
import { TicketInvoice } from '../objects/ticketinvoice';
import { TicketChange } from '../objects/ticketchange';
import { Ticketbai } from '../objects/ticketbai';
import { Verifactu } from '../objects/verfiactu';
import { MixedPayment } from '../objects/mixedpay';
import { PlaceView } from './place';
import { QrCodeView } from './qrcode';
import { ProductView } from './product';
import { ProductOptView } from './productopt';
import { OfferView } from './offer';
import { ExtraView } from './extra';
import { TicketProductView } from './ticketproduct';
import { TicketOfferView } from './ticketoffer';
import { TicketExtraView } from './ticketextra';
import { TicketDiscountView } from './ticketdiscount';
import { DiscountView } from './discount';
export interface ToCartInfo {
market?: number | null;
weight?: number | null;
comments?: string | null;
}
/****************************/
/* PRINT LOGIC */
/****************************/
export interface PrintInfo {
printer?: any, // when the device is explicetlly chosen
isauto?: boolean, // performed due to a payment operation
drawer?: boolean // drawer opening has been requested
};
class TicketPrint {
private _print_requested = false;
private _dopen_requested = false;
private _onpay_requested = false;
private _onPrint = new Subject<PrintInfo>();
private _onDrawer = new Subject<PrintInfo>();
public OnPrint = this._onPrint.asObservable();
public OnDrawer = this._onDrawer.asObservable();
constructor(private ticket: TicketView){
// nothing to do
}
get ToOpen(): boolean {
return this._dopen_requested;
}
get ToPrint(): boolean {
return this._print_requested;
}
get IsAuto(): boolean {
return this._onpay_requested;
}
/**
* drawer: The drawer must be opened when printing
* isauto: The printing operation is configured on ticket payment
* oncommit: Do not send the printing operation until the commit is completed
*/
DoPrint(drawer = false, isauto = false, oncommit = false){
if (oncommit){
this._print_requested ||= true;
this._dopen_requested ||= drawer;
this._onpay_requested ||= isauto;
}
else {
this._onPrint.next({
isauto: isauto,
drawer: drawer
});
}
}
OpenDrawer(){
this._dopen_requested = false;
this._onDrawer.next({
isauto: this._dopen_requested,
drawer: this._onpay_requested
});
}
PrintTicket(){
this._onPrint.next({
isauto: this._dopen_requested,
drawer: this._onpay_requested
})
// ticket is printed: reset
this._print_requested = false;
this._dopen_requested = false;
this._onpay_requested = false;
}
}
/****************************/
/* COMMIT LOGIC */
/****************************/
export class TicketCommit {
private _onCommit = new Subject<void>();
public OnCommit = this._onCommit.asObservable();
constructor(private data: dataService, private ticket: TicketView){
// nothing to do
}
private get place(): PlaceView | null {
return this.ticket.place;
}
private _ticketprint: TicketPrint | null = null;
private get print(): TicketPrint {
if (this._ticketprint === null){
this._ticketprint = new TicketPrint(this.ticket);
}
return this._ticketprint;
}
async CommitTicket(payment: TicketPayment | null, transaction: dataTransaction | null): Promise <void> {
const _ini = performance.now();
// update ticket status (if not avaiable)
if (this.ticket.status == 'PR'){
this.ticket.status = 'AC';
}
if (this.ticket.IsEmpty){
this.ticket.status = 'CC';
}
const _orderpromise = this._OrderNo(); // request for a orderno (async)
this._OpenDrawer(_ini); // open the drawer before commiting
await this._TicketChange(_ini); // create the ticketchange instance
await _orderpromise; // wait to receive the order number
this._PrintTicket(_ini); // send the ticket to the printer
await this._CommitTicket(transaction, _ini); // commit the ticket
this._LogLocalChange(_ini); // notify local activity
}
PrintTicket(drawer = false, isauto = false, oncommit = false){
return this.print.DoPrint(drawer, isauto, oncommit);
}
/**********************************/
/* PRIVATE METHODS */
/**********************************/
private _OrderNo(): Promise<void> {
return new Promise <void> ((resolve) => {
if (this.ticket.orderno){
resolve();
}
else { // request an unique orderno to the server
// TODO
setTimeout(() => {
this.ticket.orderno = 'TODO'
resolve();
}, 500);
}
});
}
private _OpenDrawer(_ini: DOMHighResTimeStamp): void {
if (this.print.ToOpen){
this.print.OpenDrawer();
}
console.info("[TICKET] On drawer check completed in " + (performance.now() - _ini).toFixed(2) + " ms")
}
private async _TicketChange(_ini: DOMHighResTimeStamp): Promise <void> {
const lastchange: TicketChange | null = this.ticket.lastchange;
let changereason: TicketChangeReason | null = null;
if (lastchange){
changereason = lastchange.ChangeReason;
}
else {
changereason = this.ticket.IsCancelled ? 'C' : 'F';
}
// reopened ticket being repaid: always rectificative
if (lastchange !== null && this.ticket.payment != null && this.ticket.ReopenedFlag && !changereason){
changereason = 'P';
}
// if not changes: then we are done
if (!changereason || changereason === 'C'){
return;
}
if (lastchange === null) {
// first commit: provisional X numbering for unpaid tickets, no TicketChange
if (this.ticket.payment == null){
if (!this.ticket.invceno?.startsWith('X')){
const [_serial, _invice] = await this._NextInvoice(SerialType.X, InvoiceType.X);
this.ticket.series = _serial;
this.ticket.invceno = _invice;
console.info("[TICKET] " + this.ticket.series + " " + this.ticket.invceno);
}
return;
}
}
else { // reopened ticket without payment has no fiscal impact
if (this.ticket.payment == null){
return;
}
}
// create TicketChange: first (F, prev=null) or rectificative (P, prev=lastchange)
console.info("[TICKET] Creating ticket change in " + (performance.now() - _ini).toFixed(2) + " ms..")
await this._InvoiceNumber(changereason);
const nextchange = new TicketChange(null, this.data);
if (nextchange){
nextchange.ticket = this.ticket.object;
nextchange.prev = lastchange;
nextchange.session = this.data.session;
nextchange.client = null; // TODO
nextchange.series = this.ticket.series;
nextchange.invoice = this.ticket.invceno;
nextchange.total = this.ticket.priceinfo.tax.total;
nextchange.base = this.ticket.priceinfo.tax.base;
nextchange.taxes = this.ticket.priceinfo.tax.taxes;
}
this.ticket.AddChange(nextchange);
console.info("[TICKET] Creating taxes information in " + (performance.now() - _ini).toFixed(2) + " ms..")
await this.SendVerifactu(nextchange);
await this.SendTicketbai(nextchange);
console.info("[TICKET] Completed taxes information in " + (performance.now() - _ini).toFixed(2) + " ms..")
}
private _PrintTicket(_ini: DOMHighResTimeStamp): void {
if (this.print.ToPrint){
this.print.PrintTicket();
}
console.info("[TICKET] Ticket print check completed in " + (performance.now() - _ini).toFixed(2) + " ms")
}
private async _CommitTicket(transaction: dataTransaction | null, _ini: DOMHighResTimeStamp): Promise <void> {
// prepare the ticket for the commit
Iif (this.ticket.CopyOf){
this.ticket.Overwrite();
}
// perfom the commit to the server
const _ticket: Ticket = this.ticket.CopyOf as Ticket || this.ticket.object;
if (transaction){
if (await transaction.push(_ticket)){
console.info("[TICKET] Commited ticket [" + _ticket.objid + "] with flags [" + _ticket.flags + "] completed in " + (performance.now() - _ini).toFixed(2) + " ms");
this._onCommit.next();
}
}
else {
_ticket.DoCommit().then(
(result: boolean) => {
if (result){
console.info("[TICKET] Commited ticket [" + _ticket.objid + "] with flags [" + _ticket.flags + "] completed in " + (performance.now() - _ini).toFixed(2) + " ms");
this._onCommit.next();
}
});
}
// adds the ticket into the place
const place = this.ticket.place;
if (place){
place.AddTicket(_ticket);
}
// adds the ticket into the table
const qrcode = this.ticket.qrcode;
if (qrcode){
qrcode.AddTicket(_ticket);
}
}
private _LogLocalChange(_ini: DOMHighResTimeStamp): void {
// TODO
}
/**********************************/
/* TICKET CHANGE METHODS */
/**********************************/
private async _NextInvoice(serialtype: SerialType, invoicetype: InvoiceType): Promise <(string | null)[]> {
if (this.ticket.place){
return this.ticket.place.NextDeviceTicket(serialtype, invoicetype);
}
return [ null, null ];
}
private async _InvoiceNumber(reason: TicketChangeReason){
let _serial: string | null = null;
let _invice: string | null = null;
switch(reason){
case 'F':
if (this.ticket.invoice == null){
[_serial, _invice] = await this._NextInvoice(SerialType.S, InvoiceType.T);
}
else { // ticket created with invoice information
[_serial, _invice] = await this._NextInvoice(SerialType.C, InvoiceType.C);
}
break;
case 'P':
[_serial, _invice] = await this._NextInvoice(SerialType.R, InvoiceType.R);
break;
case 'I':
[_serial, _invice] = await this._NextInvoice(SerialType.F, InvoiceType.F);
break;
default:
if ((this.ticket.series == null) || (this.ticket.invceno == null)){
throw new Error("[TICKET] invoice number not provided when it should");
}
break;
}
this.ticket.series = _serial;
this.ticket.invceno = _invice;
if (this.ticket.series && this.ticket.invceno){
console.info("[TICKET] " + this.ticket.series + " " + this.ticket.invceno);
}
else {
console.info("[TICKET] Sending ticket without invoice number (will be calculated on server)")
}
}
private async SendVerifactu(change: TicketChange){
if (!this.ticket.place){
return;
}
if (this.ticket.place.SendVFTEnabled){
Iif (change.verifactu){
console.warn("[TICKET] overwriting verifactu instance will bave no effect");
}
else {
const verifactu = new Verifactu(null, this.data);
if (verifactu){
verifactu.change = change;
Iif (await verifactu.Refresh() != null){
change.AddVerifactu(verifactu)
}
}
}
}
}
private async SendTicketbai(change: TicketChange){
if (!this.ticket.place){
return;
}
if (this.ticket.place.SendBAIEnabled){
Iif (change.ticketbai){
console.warn("[TICKET] overwriting ticketbai instance will bave no effect");
}
else {
const ticketbai = new Ticketbai(null, this.data);
if (ticketbai){
ticketbai.change = change;
Iif (await ticketbai.Refresh() != null){
change.AddTicketbai(ticketbai)
}
}
}
}
}
}
/****************************/
/* CLASS VIEW */
/****************************/
export class _TicketView extends ViewObject<Ticket> {
/**********************************/
/* VIEWOBJECT IMPLEMENTATION */
/**********************************/
private get ticket(): Ticket{
return this.object;
}
constructor(object: Ticket, data: dataService){
super(object, data);
}
override OnDestroy(): void {
super.OnDestroy();
}
/**********************************/
/* INJECTOR SERVICES */
/**********************************/
private _lang: languageService | null = null;
private get lang(): languageService {
Iif (!this._lang){
this._lang = this.data.injector.get(languageService);
}
return this._lang;
}
private _toast: toastService | null = null;
private get toast(): toastService {
Iif (!this._toast){
this._toast = this.data.injector.get(toastService);
}
return this._toast;
}
/**********************************/
/* VIEW MANAGED INFORMATION */
/**********************************/
private _validinvoice: TicketInvoice | null = null;
private _validproducts: Array <TicketProductView> | null = null;
private _validoffers: Array <TicketOfferView> | null = null;
private _validextras: Array <TicketExtraView> | null = null;
private _validdiscounts: Array <TicketDiscountView> | null = null;
private _validmixed: Array <MixedPayment> | null = null;
private _validchanges: Array <TicketChange> | null = null;
private _validlastchange: TicketChange | null = null;
private _calcpriceinfo: PriceType | null = null;
private _updateinvoice = true;
private _productslength = 0;
private RefreshView(targets: string[]){
Iif (targets.includes('TICKET')){
this.DoRefreshView();
}
Iif (targets.includes('QRCODE')){
this.DoRefreshView();
}
Iif (targets.includes('TICKETPRODUCT')){
this._calcpriceinfo = null;
this._validproducts = null;
this.DoRefreshView();
}
Iif (targets.includes('TICKETOFFER')){
this._calcpriceinfo = null;
this._validoffers = null;
this.DoRefreshView();
}
Iif (targets.includes('TICKETEXTRA')){
this._calcpriceinfo = null;
this._validextras = null;
this.DoRefreshView();
}
Iif (targets.includes('TICKETDISCOUNT')){
this._calcpriceinfo = null;
this._validdiscounts = null;
this.DoRefreshView();
}
Iif (targets.includes('TICKETMIXEDPAY')){
this._validmixed = null;
this.DoRefreshView();
}
Iif (targets.includes('TICKETCHANGE')){
this._validchanges = null;
this._validlastchange = null;
this.DoRefreshView();
}
Iif (targets.includes('TICKETINVOICE')){
this._updateinvoice = true;
this.DoRefreshView();
}
}
/**********************************/
/* CHILDREN REGISTRATION */
/**********************************/
override doRegister(): void{
const weakref = new WeakRef(this);
// deregister of current subscriptions
for (const _subsription of this._subscriptions){
_subsription.unsubscribe();
}
this._subscriptions = [];
// register to updates on contained items
this._subscriptions.push(
this.ticket.OnRefresh.subscribe(
(targets: string[]) => {
const self = weakref.deref();
Iif (self){ // do not keep strong references in subscription
self.RefreshView(targets);
}
})
);
// register for changes in ticket products
for (const product of this.products){
this._subscriptions.push(
product.OnRefresh.subscribe(
(targets: string[]) => {
const self = weakref.deref();
Iif (self){ // do not keep strong references in subscription
self.RefreshView(targets);
}
})
);
}
}
/**********************************/
/* ACTIVE CHILDREN INFORMATION */
/**********************************/
get status(): string | null {
return this.ticket.status;
}
set status(value: string) {
// auto-ready the tickets based on configuration
Iif (this.ticket.status == 'PR'){
Iif (this.place && !this.place.TicketPreparation){
this.ticket.status = 'RD';
}
}
this.ticket.status = value;
}
get invoice(): TicketInvoice | null {
Iif (this._updateinvoice){
this._updateinvoice = false;
this._validinvoice = this.ticket.invoice;
}
return this._validinvoice;
}
set invoice(value: TicketInvoice | null){
this.ticket.invoice = value;
}
get place(): PlaceView | null {
return this.data.alives.get(this.ticket.place) as PlaceView;
}
get qrcode(): QrCodeView | null {
return this.data.alives.get(this.ticket.qrcode) as QrCodeView;
}
set qrcode(value: QrCodeView | null){
Iif (this.ticket.qrcode) {
this.ticket.qrcode.DelTicket(this.ticket);
}
this.ticket.qrcode = value?.object ?? null;
Iif (this.ticket.qrcode) {
this.ticket.qrcode.AddTicket(this.ticket);
}
}
get changes(): Array<TicketChange> {
Iif (this._validchanges === null){
const _ticketchanges: Array <TicketChange> = this.ticket.changes.slice(0);
_ticketchanges.sort((a, b) => {
const _acreated = a.created.getTime();
const _bcreated = b.created.getTime();
return _acreated - _bcreated;
});
this._validchanges = _ticketchanges;
}
return this._validchanges;
}
get lastchange(): TicketChange | null {
Iif (this._validlastchange === null){
this._validlastchange = this.changes[this.changes.length -1];
}
return this._validlastchange || null;
}
private _backwardsgroup = false;
get products(): Array <TicketProductView> {
if (this._validproducts === null){
const _products: Array <TicketProductView> = [];
this._productslength = 0;
for(const _product of this.ticket.products){
Iif (_product.IsValid){
const _productview = this.alives.get(_product) as TicketProductView;
Iif (_productview){
_products.push(_productview);
this._productslength += _productview.amount || 1;
}
}
}
// the last sorted product is the first
_products.sort((a, b) => {
const _asort: number = a.sort || 0;
const _bsort: number = b.sort || 0;
return (_asort - _bsort);
})
this._validproducts = _products;
/*
Note: Required for backwards compatibilty
TicketProducts does not provide the quantity in previous versions
As every entry is one item, must be grouped here in order to work
*/
if (!this._backwardsgroup){
this._backwardsgroup = true;
this.GroupProducts();
}
}
return this._validproducts;
}
// calculated at the same time as the products list
get ProductsLength(): number {
return this._productslength;
}
get offers(): Array <TicketOfferView> {
if (this._validoffers === null){
const _offers: Array <TicketOfferView> = [];
for(const _offer of this.ticket.offers){
Iif (_offer.IsValid){
const _offerview = this.alives.get(_offer) as TicketOfferView;
Iif (_offerview){
_offers.push(_offerview);
}
}
}
this._validoffers = _offers;
}
return this._validoffers;
}
get extras(): Array <TicketExtraView> {
if (this._validextras === null){
const _extras: Array <TicketExtraView> = [];
for (const _extra of this.ticket.extras){
Iif (_extra.IsValid){
const _extraview = this.alives.get(_extra) as TicketExtraView;
Iif (_extraview){
_extras.push(_extraview);
}
}
}
this._validextras = _extras;
}
return this._validextras;
}
get discounts(): Array <TicketDiscountView> {
Iif (this._validdiscounts === null){
const _discounts: Array <TicketDiscountView> = [];
for (const _discount of this.ticket.discounts){
Iif (_discount.IsValid){
const _discountview = this.alives.get(_discount) as TicketDiscountView;
Iif (_discountview){
_discounts.push(_discountview);
}
}
}
this._validdiscounts = _discounts;
}
return this._validdiscounts;
}
get mixed(): Array <MixedPayment> {
Iif (this._validmixed === null){
const _mixedpayments: Array <MixedPayment> = [];
for (const _mixed of this.ticket.mixed){
_mixedpayments.push(_mixed);
}
this._validmixed = _mixedpayments;
}
return this._validmixed;
}
/**********************************/
/* TICKET BEHAVIOUR */
/**********************************/
config(item: string){
return null; // TODO: determine the ticket behaviour based on the place configuration
}
/**********************************/
/* CUSTOM METHODS */
/**********************************/
get empty(): boolean {
return (this.products.length == 0);
}
get maxprice(): number {
return AppConstants.invoiceMaxPrice;
}
get ToInvoice(): boolean {
return this.priceinfo.val >= this.maxprice;
}
/**********************************/
/* CLASS MEMBERS */
/**********************************/
get payment(): TicketPayment | null {
return this.ticket.payment;
}
set payment(value: TicketPayment | null){
if (value){
// if ticket is paid, we are only changing the payment type
Iif (!this.IsPaid && !this.IsToPay){
Iif (this.ticket.invceac == null){ // not paying the account
const _oncash: boolean = (value == 'PAYCASH') && (this.place?.OpenOnCash || false);
const _oncard: boolean = (value == 'PAYCARD') && (this.place?.OpenOnCard || false);
this.Commiter.PrintTicket(_oncash || _oncard, true, true);
}
this.ticket.paidby = this.data.session;
this.ticket.paidon = new Date();
this.ticket.paidin = null; // TODO: hay que poner el till desde el que se paga
this.status = (value == 'PAYACCOUNT') ? 'PP': 'PD';
}
}
else { // payment has been removed
this.ticket.paidby = null;
this.ticket.given = null;
this.ticket.paidon = null;
this.ticket.paidin = null;
this.status = 'AC';
}
this.ticket.payment = value;
}
private _pendpay: TicketPayment | null = null;
get pendpay(): TicketPayment | null {
return this._pendpay;
}
set pendpay(payment: TicketPayment | null){
this._pendpay = payment;
}
/**********************************/
/* TICKET STATUS */
/**********************************/
get IsRecent(): boolean {
return ((new Date()).getTime() - this.ticket.updated.getTime()) < AppConstants.recentMs;
}
get IsEmpty(): boolean {
return (this.products.length == 0);
}
/**
* Ticket is opened when
* The status is not 'PR' (preparation)
* and the ticket is not cancelled
* and the ticket is not ready and has not been paid
*
* If the place requires prepayment:
* - The ticket must been paid to be opened
*/
get IsOpened(): boolean {
Iif (!this.status && (this.status == 'PR')){
return false;
}
Iif (this.IsCancel){
return false;
}
Iif (!this.IsReady){
return true; // the ticket must be ready to be closed
}
Iif (this.place){
Iif (this.IsPaid){
return false; // the ticket must be paid to be closed
}
// not paid: if prepayment is required, then it is closed
return !this.place.TicketPrepayment;
}
return false;
}
/**
* Ticket is closed when
* it is not opened
*/
get IsClosed(): boolean {
return !this.IsOpened;
}
/**
* Flag is marked when ready
* return the flag value
*/
get IsReady(): boolean {
return this.ticket.ReadyFlag;
}
/**
* Flag is marked when paiment requested
* return the flag value
*/
get IsToPay(): boolean {
return this.ticket.ToPayFlag;
}
/**
* Flag is marked when paid
* return the flag value
*/
get IsPaid(): boolean {
return this.ticket.PaidFlag;
}
/**
* Ticket is cancelled when:
* Cancellation has been requested
* and no refunds are pending
*/
get IsCancel(): boolean {
Iif (this.ticket.IsCancelled){
return (this.ToRefund == 0);
}
return false;
}
/**********************************/
/* TICKET PRICE */
/**********************************/
get priceinfo(): PriceType {
Iif (this._calcpriceinfo === null){
this._calcpriceinfo = this._PriceInfo((this.ticket.CopyOf != null) || this.ticket.ToInsert);
}
return this._calcpriceinfo;
}
get ToRefund(): number {
return 0; // TODO
}
/**********************************/
/* INTERNAL CLASSES */
/**********************************/
private _ticketcommit: TicketCommit | null = null;
private get Commiter(): TicketCommit {
Iif (this._ticketcommit === null){
this._ticketcommit = new TicketCommit(this.data, this.alives.get(this.ticket) as TicketView);
}
return this._ticketcommit;
}
/**********************************/
/* TICKET ACTIONS */
/**********************************/
private _onTicketUpdated = new Subject <void> ();
OnTicketUpdated = this._onTicketUpdated.asObservable();
get CanPrint(): boolean {
return true; // TODO
}
get CanSend(): boolean {
return true; // TODO
// return this._canupdateticket;
}
get CanCash(): boolean {
Iif (!this.place){
return false;
}
return this.place.CanCash;
}
get CanCard(): boolean {
Iif (!this.place){
return false;
}
return this.place.CanCard;
}
get CanAccount(): boolean {
Iif (!this.place){
return false;
}
return this.place.CanAccount;
}
async OnCommit(payment: TicketPayment | null, transaction: dataTransaction | null = null): Promise <void> {
await this.Commiter.CommitTicket(payment, transaction);
Iif (this.ticket.IsDeleted){
return; // do not notify deleted tickets
}
if (this.ticket.IsCancelled){
this.toast.ShowAlert('danger', this.lang.tr('@place_ticket_cancelled_toast'), 2000);
}
else {
this.toast.ShowAlert('primary', this.lang.tr('@place_ticket_sent_toast'), 2000);
}
}
OnOpen(): void {
// perform any pending refund operation
for(const ticketproduct of this.products){
Iif (ticketproduct.status == 'UN'){
ticketproduct.status = 'DE';
}
}
for(const ticketoffer of this.offers){
Iif (ticketoffer.status == 'UN'){
ticketoffer.status = 'DE';
}
}
for(const ticketextra of this.extras){
Iif (ticketextra.status == 'UN'){
ticketextra.status = 'DE';
}
}
// remove ticket payment information
this.ticket.invoice = null;
this.ticket.account = null;
this.ticket.session = this.data.session;
this.ticket.payment = null;
this.ticket.ReopenedFlag = true;
// restore ticket status to 'opened'
this.status = 'AC';
}
OnCancel(): void {
this.status = 'CC';
}
OnReady(): void {
this.status = 'RD';
}
OnMerge(merge: TicketView): void {
// check if discounts can be merged
for (const ticketdiscount of merge.discounts){
const discount: DiscountView | null = ticketdiscount.discount;
Iif (!discount || !discount.AppliesTo(this.alives.get(this.ticket) as TicketView)){
console.warn("[TICKET] Discount cannot be applied: Merge operation cancelled");
return; // should be checked before operation
}
}
// add the merged ticketproducts to this ticket
for (const ticketproduct of merge.products){
Iif (ticketproduct.product){
this.ToCart(ticketproduct.product, ticketproduct.options, ticketproduct.amount, { comments: ticketproduct.comments });
}
}
// add the merged ticketdiscounts to this ticket
for (const ticketdiscount of merge.discounts){
Iif (ticketdiscount.discount){
this.AddDiscount(ticketdiscount.discount);
}
}
// delete the merged ticket
merge.status = 'DE';
}
ToCart(product: ProductView, options: Array <ProductOptView>, amount: number, info: ToCartInfo | null){
this._onTicketUpdated.next();
const _ticketproduct = new TicketProduct(null, this.data);
Iif (_ticketproduct){
_ticketproduct.ticket = this.ticket;
_ticketproduct.product = product.object;
_ticketproduct.amount = amount;
_ticketproduct.taxrate = product.taxrate;
_ticketproduct.status = 'AC';
Iif (info){
_ticketproduct.market = info.market || null;
_ticketproduct.weight = info.weight || null;
_ticketproduct.comments = info.comments || null;
}
for(const _option of options){
const _ticketoption = new TicketOption(null, this.data);
Iif (_ticketoption){
_ticketoption.product = _ticketproduct;
_ticketoption.option = _option.object;
_ticketoption.status = 'AC';
_ticketproduct.AddOption(_ticketoption);
}
}
}
const _ticketproductview = this.alives.get(_ticketproduct) as TicketProductView;
Iif (_ticketproductview){
this.AddTicketProduct(_ticketproductview, this.products.length);
}
}
AddOneOf(ticketproduct: TicketProductView): void {
this._onTicketUpdated.next();
const _copy = ticketproduct.object.Copy() as TicketProduct;
Iif (_copy){
_copy.CopyOf = null; // this is not a copy any more
_copy.amount = 1;
_copy.offer = null;
_copy.sort = null;
_copy.charge = null;
_copy.refund = null;
}
const _ticketproductview = this.alives.get(_copy) as TicketProductView;
Iif (_ticketproductview){
this.AddTicketProduct(_ticketproductview, (ticketproduct.sort || 0) + 1);
}
}
DelOneOf(ticketproduct: TicketProductView): void {
this._onTicketUpdated.next();
const products: Array <TicketProductView> = [];
for (const _ticketproduct of this.products){
Iif (_ticketproduct.IsJoin(ticketproduct)){
products.push(_ticketproduct);
}
}
// find the suitable one with greater amount
let _candidate: TicketProductView = ticketproduct;
for (const _ticketproduct of products){
Iif (_ticketproduct.amount > _candidate.amount){
_candidate = _ticketproduct;
}
}
_candidate.amount--;
}
AddSplit(){
this._onTicketUpdated.next();
const _ticketproduct = new TicketProduct(null, this.data);
Iif (_ticketproduct){
_ticketproduct.ticket = this.ticket;
_ticketproduct.status = 'SP';
}
const _ticketproductview = this.alives.get(_ticketproduct) as TicketProductView;
Iif (_ticketproductview){
this.AddTicketProduct(_ticketproductview, this.products.length);
}
}
AddDiscount(discount: DiscountView){
this._onTicketUpdated.next();
this.AddTicketDiscount(discount);
}
/**********************************/
/* RECYCLE PRODUCTS */
/**********************************/
private _torecycle: Array <TicketProductView> = [];
private AddRecycle(ticketproduct: TicketProductView): void {
ticketproduct.status = 'RC';
this._torecycle.push(ticketproduct);
}
private GetRecycle(ticketproduct: TicketProductView): TicketProductView {
for (let _idx = this._torecycle.length-1; _idx >= 0; _idx --){
Iif (ticketproduct.IsJoin(this._torecycle[_idx])){
const _recycled = this._torecycle.splice(_idx, 1)[0];
Iif (_recycled){ // adjust to the requested item
_recycled.amount = ticketproduct.amount;
_recycled.status = ticketproduct.status;
}
return _recycled;
}
}
return ticketproduct; // not found (cannot be reused)
}
private DelRecycle(){
for (const ticketproduct of this._torecycle){
ticketproduct.status = 'DE';
}
}
/**********************************/
/* PRIVATE METHODS */
/**********************************/
private _PriceInfo(recalculate = false): PriceType {
const _calcpriceinfo = new PriceInfo();
Iif (recalculate){
this._torecycle = [];
this.ClearOffers();
this.GroupProducts(false);
this.ApplyOffers();
this.GroupProducts(true);
this.DelRecycle();
}
// apply products and offers into the final price
for(const _ticketproduct of this.products){
const _charge: number = (recalculate ? _ticketproduct.calcinfo.charge : _ticketproduct.charge) || 0;
const _amount: number = (recalculate ? _ticketproduct.calcinfo.amount : _ticketproduct.amount) || 0;
const _p: number = _charge * _amount;
const _r: number = (_ticketproduct.taxrate || AppConstants.defaultTaxRate)
_calcpriceinfo.Add(_p, _r);
}
// apply extras into the final price
this.ApplyExtras();
for(const _ticketextra of this.extras){
const _p: number = (recalculate ? _ticketextra.calcinfo.charge : _ticketextra.charge) || 0;
const _r: number = (_ticketextra.taxrate || AppConstants.defaultTaxRate);
_calcpriceinfo.Add(_p, _r);
}
// apply discounts into the final price
this.ApplyDiscounts();
for (const _ticketdiscount of this.discounts){
_calcpriceinfo.Del(_ticketdiscount.charge || 0);
}
const _calculatedprice = _calcpriceinfo.price;
// update the ticket information
this.ticket.price = _calculatedprice.tax.total;
this.ticket.taxes = _calculatedprice.tax.taxes;
return _calculatedprice;
}
private _GroupProducts(ticketproducts: Array <TicketProductView>){
const _products_toequal: Array <TicketProductView> = ticketproducts.slice(0);
Iif (_products_toequal.length < 2){
return; // nothing to be grouped
}
while (_products_toequal.length > 0){
const product = _products_toequal.shift();
Iif (product){
let _isequal: TicketProductView | null = null;
for(const _product of _products_toequal){
// product will be joined into _product
Iif (_product.IsEqual(product)){
_isequal = _product;
}
Iif (_isequal != null){
break; // already found a product to group
}
}
Iif (_isequal){
_isequal.Merge(product) // merge the product into the equivalent
this.AddRecycle(product); // add the product to be recycled (or removed)
}
}
}
}
private _DisplayProducts(ticketproducts: Array <TicketProductView>){
const _products_togroup: Array <TicketProductView> = ticketproducts.slice(0);
Iif (_products_togroup.length < 2){
return; // nothing to be grouped
}
while (_products_togroup.length > 0){
const product = _products_togroup.shift();
Iif (product){
let _display: TicketProductView | null = null;
for(const _product of _products_togroup){
// product will be displayed into _product
Iif (_product.IsGroup(product)){
_display = _product;
}
Iif (_display != null){
break; // already found a product to display
}
}
product.DisplayTo = _display;
Iif (_display){
product.sort = _display.sort;
}
}
}
}
private _DisplayOffers(){
const _offers_togroup: Array <TicketOfferView> = this.offers.slice(0);
Iif (_offers_togroup.length < 2){
return; // nothing to be grouped
}
while (_offers_togroup.length > 0){
const offer = _offers_togroup.shift();
Iif (offer){
let _display: TicketOfferView | null = null;
for(const _offer of _offers_togroup){
// offer will be displayed into _offer
Iif (_offer.IsGroup(offer)){
_display = _offer;
}
Iif (_display != null){
break; // already found a product to display
}
}
offer.DisplayTo = _display;
}
}
}
private _CreateSections(): Array <TicketProductView[]> {
const sections: Array <TicketProductView[]> = [];
const _products = this.products.slice(0);
let _section: Array<TicketProductView> | null = null;
for (const ticketproduct of _products){
Iif (_section == null){
_section = [];
}
if (ticketproduct.IsSplitter){
if (_section.length > 0){
sections.push(_section);
_section = null;
}
else { // no products in section (remove splitter)
ticketproduct.status = 'DE';
}
}
else {
_section.unshift(ticketproduct);
}
}
Iif (_section){ // last section
sections.unshift(_section);
}
return sections;
}
private GroupProducts(display = false): void {
// clear previous display grouping
for(const ticketproduct of this.products){
ticketproduct.DisplayTo = null;
}
if (this.products.length < 2){
return; // nothing to be grouped
}
// merge products by equality
const sections: Array <TicketProductView[]> = this._CreateSections();
for(const section of sections){
this._GroupProducts(section);
}
// refresh the product sorting order
let _sort = 0;
for (const ticketproduct of this.products){
ticketproduct.sort = _sort;
Iif (ticketproduct.Display){
_sort = _sort + 1;
}
}
this.doRegister(); // refresh the registration items
Iif (display){
for(const section of sections){
this._DisplayProducts(section); // merge products for display
}
this._DisplayOffers(); // merge offers for display
}
}
private AddTicketProduct(ticketproduct: TicketProductView, where: number | null, force = false){
// try to increase an existing ticketproduct
let _candidate: TicketProductView | null = null;
Iif (!force){ // if force: we need to add the product (do not reuse)
for(const _ticketproduct of this.products){
Iif (ticketproduct.IsEqual(_ticketproduct)){
_candidate = _ticketproduct;
}
Iif (_candidate != null){
break; // found a candidate to add to
}
}
}
if (_candidate){
_candidate.amount++;
}
else { // no candidate to increase: include the new ticketproduct
Iif (where !== null){
ticketproduct.sort = where;
// make the gap for the new product
for (const product of this.products){
const _oldsort = product.sort || 0;
Iif (_oldsort >= ticketproduct.sort){
product.sort = _oldsort + 1;
}
}
}
this.ticket.AddProduct(ticketproduct.object);
}
}
private AddTicketOffer(offer: OfferView): void {
const ticketview = this.alives.get(this.ticket) as TicketView;
Iif (!ticketview){
return;
}
const appliedproducts = offer.AppliesTo(ticketview);
Iif (!appliedproducts){
return; // not applicable
}
// create the ticket offer instance
const ticketoffer = new TicketOffer(null, this.data);
Iif (ticketoffer){
ticketoffer.offer = offer.object;
ticketoffer.ticket = this.ticket;
ticketoffer.amount = 1;
ticketoffer.status = 'AC';
this.ticket.AddOffer(ticketoffer);
}
// add the ticket offer to the products
for (const [ ticketproduct, amount ] of appliedproducts){
let appliedto: TicketProductView | null = null;
if (ticketproduct.amount == amount){
appliedto = ticketproduct; // apply the offer to this product directly
}
else {
appliedto = ticketproduct.Remove(amount); // separate the product to apply the offer to
if (appliedto){
appliedto = this.GetRecycle(appliedto); // attempt to recycle existing ticketproducts
this.AddTicketProduct(appliedto, (ticketproduct.sort ? ticketproduct.sort + 1 : 0), true);
}
else {
throw new Error("[TICKET] Error applying offer (" + offer.name + ") to ticket!")
}
}
Iif (appliedto){
appliedto.offer = this.alives.get(ticketoffer) as TicketOfferView;
}
}
}
private AddTicketExtra(extra: ExtraView){
const _ticketextra = new TicketExtra(null, this.data);
Iif (_ticketextra){
_ticketextra.ticket = this.ticket;
_ticketextra.extra = extra.object;
_ticketextra.taxrate = this.place?.taxrate || AppConstants.defaultTaxRate;
_ticketextra.status = 'AC';
this.ticket.AddExtra(_ticketextra)
}
}
private AddTicketDiscount(discount: DiscountView){
const _ticketdiscount = new TicketDiscount(null, this.data);
Iif (_ticketdiscount){
_ticketdiscount.ticket = this.ticket;
_ticketdiscount.discount = discount.object;
_ticketdiscount.status = 'AC';
this.ticket.AddDiscount(_ticketdiscount)
}
}
private ClearOffers(): void {
// clear the offer information from the products
for(const ticketproduct of this.products){
Iif (ticketproduct.offer){
ticketproduct.offer = null;
}
}
}
private ApplyOffers(): void {
const ticketview = this.alives.get(this.ticket) as TicketView;
const suitable: Array<OfferView> = [];
Iif (this.place){
for(const offer of this.place.offers){
Iif (ticketview && (offer.IsActive) && (offer.SavingAmount(ticketview) !== null)) {
suitable.push(offer);
}
}
}
Iif (suitable.length == 0){
return; // no suitable offers can be applied
}
let _maxiterations = 0; // can not be more offers that products
for (const product of this.products){
_maxiterations += product.amount;
}
while (true){
let candidate: OfferView | null = null;
// choose the offer with greater savings
let _savings = 0;
for (const offerview of suitable){
const _tentative = offerview.SavingAmount(ticketview)
Iif (_tentative && (_tentative > _savings)){
candidate = offerview;
_savings = _tentative;
}
}
Iif (!candidate){
return; // no more suitable offers (completed)
}
this.AddTicketOffer(candidate);
_maxiterations--;
Iif (_maxiterations < 0){
throw new Error("[OFFERS] Detected potential infinite loop while applying offers!");
}
}
}
private ApplyExtras(): void {
const ticketview = this.alives.get(this.ticket) as TicketView;
const appliedextras = new Set <ExtraView>();
// keep or remove any extras currenty aplying
for (const ticketextra of this.extras){
Iif (ticketextra.extra){
appliedextras.add(ticketextra.extra);
Iif (ticketextra.extra.AppliesTo(ticketview)){
continue; // is applying and valid
}
}
ticketextra.status = 'DE'; // does not apply any more
}
// check for any other extras that may apply
Iif (this.place){
for (const extra of this.place.extras){
Iif (!appliedextras.has(extra) && extra.AppliesTo(ticketview)){
this.AddTicketExtra(extra);
}
}
}
}
private ApplyDiscounts(): void {
for (const _ticketdiscount of this.discounts){
void _ticketdiscount.calcinfo;
}
}
}
/****************************/
/* PROXY VIEW */
/****************************/
export type TicketView = ViewType <_TicketView, Ticket>;
export function TicketViewProxy(object: Ticket, data: dataService): TicketView {
return new _TicketView(object, data).Proxy as TicketView;
}
|