Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jiloysss/tailpos-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jiloysss committed Nov 26, 2019
2 parents 1f865f6 + b53a428 commit 4987853
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/container/ReceiptInfoContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,9 @@ export default class ReceiptInfoContainer extends React.Component {

// payment receipt
if (this.state.reasonValue) {
paymentReceipt.changeReason(this.state.reasonValue);
paymentReceipt.cancelled(paymentReceipt);
paymentReceipt.setCancel(this.state.reasonValue);
// paymentReceipt.changeReason(this.state.reasonValue);
// paymentReceipt.cancelled(paymentReceipt);
this.props.shiftStore.setNewValues(obj);

// Navigate to payment store
Expand Down
2 changes: 2 additions & 0 deletions src/container/SalesContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ export default class SalesContainer extends React.Component {
setViewingOrder,
} = this.props.stateStore;
const { defaultReceipt } = this.props.receiptStore;
const { defaultShift } = this.props.shiftStore;
const table = { id: currentTable };

showAlert(
Expand All @@ -762,6 +763,7 @@ export default class SalesContainer extends React.Component {
setCurrentTable(-1);
defaultReceipt.clear();
setViewingOrder(false);
defaultShift.orderVoid();
showToast(`${strings.Order} ${res.table_no} ${strings.IsCancelled}`);
});
},
Expand Down
6 changes: 6 additions & 0 deletions src/store/PosStore/ReceiptStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,12 @@ export const Receipt = types
// self.dateUpdate = Date.now;
self.syncStatus = true;
},
setCancel(reason) {
self.reason = reason;
self.status = "cancelled";
self.dateUpdated = Date.now();
self.syncStatus = false;
},
}));

const Store = types
Expand Down
8 changes: 8 additions & 0 deletions src/store/PosStore/ShiftStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ export const Shift = types
changeShort() {
self.short = 0;
},
receiptCancelled(cancelled) {
// self.voided = self.voided + 1;
self.cancelled = self.cancelled + parseFloat(cancelled);
},
orderVoid() {
self.voided = self.voided + 1;
},
changeValues(obj) {
self.beginning_cash += obj.beginning_cash;
self.ending_cash += obj.ending_cash;
Expand Down Expand Up @@ -297,6 +304,7 @@ const ShiftStore = types
},
setNewValues(obj) {
self.defaultShift.minusValues(obj);
self.defaultShift.receiptCancelled(obj.total);
},
findShift(id) {
return new Promise(function(resolve, reject) {
Expand Down
10 changes: 8 additions & 2 deletions src/stories/components/SingleReportComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,15 +309,21 @@ const SingleReportComponent = props => {
<Text>Cancelled</Text>
</Col>
<Col style={{ alignItems: "flex-end" }}>
<Text>0</Text>
<Text>
{props.isCurrencyDisabled
? formatNumber(props.report.cancelled)
: new MoneyCurrency(
props.currency ? props.currency : "PHP",
).moneyFormat(formatNumber(props.report.cancelled))}
</Text>
</Col>
</Row>
<Row>
<Col>
<Text>Voided</Text>
</Col>
<Col style={{ alignItems: "flex-end" }}>
<Text>0</Text>
<Text>{props.report.voided}</Text>
</Col>
</Row>
</Grid>
Expand Down

0 comments on commit 4987853

Please sign in to comment.