Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0038641 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
feature request | [Retail Modules] Cash up | minor | have not tried | 2018-05-28 11:57 | 2019-03-27 18:47 | |||
Reporter | ebecerra | View Status | public | |||||
Assigned To | Retail | |||||||
Priority | normal | Resolution | fixed | Fixed in Version | RR19Q2 | |||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Review Assigned To | marvintm | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0038641: Improvement in Cash Up in the "Count Cash" and "Post, Print & Close" steps | |||||||
Description | Allow to group the payments for expected quantity. For payment with 0 expected quantity will be automatically validated in Count Cash step. | |||||||
Steps To Reproduce | N/A | |||||||
Tags | No tags attached. | |||||||
Attached Files | posterminal.diff [^] (31,733 bytes) 2019-01-25 09:09 [Show Content] [Hide Content]diff --git a/src-db/database/sourcedata/AD_PREFERENCE.xml b/src-db/database/sourcedata/AD_PREFERENCE.xml --- a/src-db/database/sourcedata/AD_PREFERENCE.xml +++ b/src-db/database/sourcedata/AD_PREFERENCE.xml @@ -847,6 +847,17 @@ <!--79863EBEE77B48B48B507832E32D8A90--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> <!--79863EBEE77B48B48B507832E32D8A90--></AD_PREFERENCE> +<!--7A9148D8DBBB471587F525CF41BC2331--><AD_PREFERENCE> +<!--7A9148D8DBBB471587F525CF41BC2331--> <AD_PREFERENCE_ID><![CDATA[7A9148D8DBBB471587F525CF41BC2331]]></AD_PREFERENCE_ID> +<!--7A9148D8DBBB471587F525CF41BC2331--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--7A9148D8DBBB471587F525CF41BC2331--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--7A9148D8DBBB471587F525CF41BC2331--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--7A9148D8DBBB471587F525CF41BC2331--> <VALUE><![CDATA[N]]></VALUE> +<!--7A9148D8DBBB471587F525CF41BC2331--> <PROPERTY><![CDATA[OBPOS_retail.cashupGroupExpectedPayment]]></PROPERTY> +<!--7A9148D8DBBB471587F525CF41BC2331--> <ISPROPERTYLIST><![CDATA[Y]]></ISPROPERTYLIST> +<!--7A9148D8DBBB471587F525CF41BC2331--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> +<!--7A9148D8DBBB471587F525CF41BC2331--></AD_PREFERENCE> + <!--7B29259DECEB4E108200BFA281A94452--><AD_PREFERENCE> <!--7B29259DECEB4E108200BFA281A94452--> <AD_PREFERENCE_ID><![CDATA[7B29259DECEB4E108200BFA281A94452]]></AD_PREFERENCE_ID> <!--7B29259DECEB4E108200BFA281A94452--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> @@ -1727,6 +1738,17 @@ <!--E7B66596AF84496EBEC7F6CAE5014C7D--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> <!--E7B66596AF84496EBEC7F6CAE5014C7D--></AD_PREFERENCE> +<!--E7AAB1DA23E3456382AC6415B3E4B644--><AD_PREFERENCE> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <AD_PREFERENCE_ID><![CDATA[E7AAB1DA23E3456382AC6415B3E4B644]]></AD_PREFERENCE_ID> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <VALUE><![CDATA[N]]></VALUE> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <PROPERTY><![CDATA[OBPOS_retail.cashupRemoveUnusedPayment]]></PROPERTY> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <ISPROPERTYLIST><![CDATA[Y]]></ISPROPERTYLIST> +<!--E7AAB1DA23E3456382AC6415B3E4B644--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> +<!--E7AAB1DA23E3456382AC6415B3E4B644--></AD_PREFERENCE> + <!--E8DBBD25BA754E1AAD0B06FB8C436B78--><AD_PREFERENCE> <!--E8DBBD25BA754E1AAD0B06FB8C436B78--> <AD_PREFERENCE_ID><![CDATA[E8DBBD25BA754E1AAD0B06FB8C436B78]]></AD_PREFERENCE_ID> <!--E8DBBD25BA754E1AAD0B06FB8C436B78--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff --git a/src-db/database/sourcedata/AD_REF_LIST.xml b/src-db/database/sourcedata/AD_REF_LIST.xml --- a/src-db/database/sourcedata/AD_REF_LIST.xml +++ b/src-db/database/sourcedata/AD_REF_LIST.xml @@ -703,6 +703,17 @@ <!--3AACBA31D4034ADA983CC1D5C51985D3--> <SEQNO><![CDATA[10]]></SEQNO> <!--3AACBA31D4034ADA983CC1D5C51985D3--></AD_REF_LIST> +<!--3AFE009478394E1F8FCCBD94D32123BA--><AD_REF_LIST> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <AD_REF_LIST_ID><![CDATA[3AFE009478394E1F8FCCBD94D32123BA]]></AD_REF_LIST_ID> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <VALUE><![CDATA[OBPOS_retail.cashupGroupExpectedPayment]]></VALUE> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <NAME><![CDATA[CashUp - Group the payments by expected amount]]></NAME> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID> +<!--3AFE009478394E1F8FCCBD94D32123BA--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> +<!--3AFE009478394E1F8FCCBD94D32123BA--></AD_REF_LIST> + <!--3E5BC9B9EA0041FBBA3C116AD65FF480--><AD_REF_LIST> <!--3E5BC9B9EA0041FBBA3C116AD65FF480--> <AD_REF_LIST_ID><![CDATA[3E5BC9B9EA0041FBBA3C116AD65FF480]]></AD_REF_LIST_ID> <!--3E5BC9B9EA0041FBBA3C116AD65FF480--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> @@ -1085,6 +1096,17 @@ <!--57F1001CF7734FE3AF23EFB2405E9EA8--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> <!--57F1001CF7734FE3AF23EFB2405E9EA8--></AD_REF_LIST> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--><AD_REF_LIST> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <AD_REF_LIST_ID><![CDATA[59099FCCF38A4A8DBD7B91CD463E93CD]]></AD_REF_LIST_ID> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <VALUE><![CDATA[OBPOS_retail.cashupRemoveUnusedPayment]]></VALUE> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <NAME><![CDATA[CashUp - Remove the unused payments from CashUp Report]]></NAME> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--> <AD_MODULE_ID><![CDATA[FF808181326CC34901326D53DBCF0018]]></AD_MODULE_ID> +<!--59099FCCF38A4A8DBD7B91CD463E93CD--></AD_REF_LIST> + <!--5B9E4C7ED1684FF08BA961B47070EE13--><AD_REF_LIST> <!--5B9E4C7ED1684FF08BA961B47070EE13--> <AD_REF_LIST_ID><![CDATA[5B9E4C7ED1684FF08BA961B47070EE13]]></AD_REF_LIST_ID> <!--5B9E4C7ED1684FF08BA961B47070EE13--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff --git a/src/org/openbravo/retail/posterminal/ad_reports/CashUpReport.java b/src/org/openbravo/retail/posterminal/ad_reports/CashUpReport.java --- a/src/org/openbravo/retail/posterminal/ad_reports/CashUpReport.java +++ b/src/org/openbravo/retail/posterminal/ad_reports/CashUpReport.java @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2013-2018 Openbravo SLU + * All portions are Copyright (C) 2013-2019 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -44,8 +44,10 @@ import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBDal; import org.openbravo.data.FieldProvider; +import org.openbravo.erpCommon.businessUtility.Preferences; import org.openbravo.erpCommon.utility.FieldProviderFactory; import org.openbravo.erpCommon.utility.OBMessageUtils; +import org.openbravo.erpCommon.utility.PropertyException; import org.openbravo.retail.posterminal.OBPOSAppCashup; import org.openbravo.retail.posterminal.OBPOSAppPayment; import org.openbravo.retail.posterminal.OBPOSPaymentMethodCashup; @@ -402,11 +404,63 @@ } } + try { + boolean removeUnusedPayment = "Y" + .equals(Preferences.getPreferenceValue("OBPOS_retail.cashupRemoveUnusedPayment", true, + OBContext.getOBContext().getCurrentClient(), + OBContext.getOBContext().getCurrentOrganization(), OBContext.getOBContext().getUser(), + OBContext.getOBContext().getRole(), null)); + if (removeUnusedPayment) { + HashMap<String, String> usedPaymentMethod = new HashMap<String, String>(); + addUsedPayments(usedPaymentMethod, hashMapList); + clearUnusedPayments(usedPaymentMethod, hashMapList); + } + } catch (PropertyException e1) { + log.error( + "Error getting OBPOS_UseOrderDocumentNoForRelatedDocs preference: " + e1.getMessage(), + e1); + } + data = FieldProviderFactory.getFieldProviderArray(hashMapList); renderJR(vars, response, strReportName, outputType, parameters, data, null); } + private void clearUnusedPayments(HashMap<String, String> usedPaymentMethod, + List<HashMap<String, String>> list) { + int i = 0; + while (i < list.size()) { + HashMap<String, String> item = list.get(i); + String searchKey = item.get("SEARCHKEY"); + String value = item.get("VALUE"); + String prefix = item.get("GROUPFIELD"); + if (searchKey != null && value != null) { + searchKey = searchKey.substring(prefix.length() + 1); + if (!usedPaymentMethod.containsKey(searchKey)) { + list.remove(item); + } else { + i++; + } + } else { + i++; + } + } + } + + private void addUsedPayments(HashMap<String, String> usedPaymentMethod, + List<HashMap<String, String>> list) { + for (int i = 0; i < list.size(); i++) { + HashMap<String, String> item = list.get(i); + String searchKey = item.get("SEARCHKEY"); + String value = item.get("VALUE"); + String prefix = item.get("GROUPFIELD"); + if (searchKey != null && value != null && !value.equals("0.00")) { + searchKey = searchKey.substring(prefix.length() + 1); + usedPaymentMethod.put(searchKey, "Used"); + } + } + } + private HashMap<String, String> fillReportRow(String groupField, String searchKey, String i18nLabel, String label, String value, String foreignValue, String headingLabel, String totalLabel, BigDecimal conversionRate, String isoCode) { diff --git a/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-model.js b/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-model.js --- a/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-model.js +++ b/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-model.js @@ -150,7 +150,29 @@ // Desactivate all steps me.cashupStepsDefinition[me.stepIndex('OB.CashUp.PaymentMethods')].active = false; } - me.get('paymentList').reset(tempList.models); + if (OB.MobileApp.model.hasPermission('OBPOS_retail.cashupGroupExpectedPayment', true)) { + // Split payment methods + var expectedList = _.filter(tempList.models, function (pm) { + return pm.get('expected') !== 0; + }), + emptyList = _.filter(tempList.models, function (pm) { + return pm.get('expected') === 0; + }); + + me.set('paymentExpectedList', new Backbone.Collection()); + me.set('paymentEmptyList', new Backbone.Collection()); + me.get('paymentExpectedList').reset(expectedList); + me.get('paymentEmptyList').reset(emptyList); + + if (emptyList.length > 0) { + emptyList[0].set('firstEmptyPayment', true); + } + var models = expectedList.concat(emptyList); + + me.get('paymentList').reset(models); + } else { + me.get('paymentList').reset(tempList.models); + } // Active/Desactive CashPayments and CashToKeep tabs var i, cashPayments = false, cashToKeep = false, @@ -319,17 +341,19 @@ rate: p.get('rate'), countInCashup: auxPay.paymentMethod.countpaymentincashup })); - startings.push(new Backbone.Model({ - searchKey: p.get('searchKey'), - origAmount: OB.UTIL.currency.toDefaultCurrency(fromCurrencyId, p.get('startingCash')), - amount: OB.DEC.add(0, p.get('startingCash')), - description: OB.I18N.getLabel('OBPOS_LblStarting') + ' ' + p.get('name') + paymentSharedStr, - currency: fromCurrencyId, - isocode: auxPay.isocode, - rate: p.get('rate'), - paymentId: p.get('paymentmethod_id'), - countInCashup: auxPay.paymentMethod.countpaymentincashup - })); + if (OB.MobileApp.model.paymentnames[p.get('searchKey')] && OB.MobileApp.model.paymentnames[p.get('searchKey')].paymentMethod.countpaymentincashup) { + startings.push(new Backbone.Model({ + searchKey: p.get('searchKey'), + origAmount: OB.UTIL.currency.toDefaultCurrency(fromCurrencyId, p.get('startingCash')), + amount: OB.DEC.add(0, p.get('startingCash')), + description: OB.I18N.getLabel('OBPOS_LblStarting') + ' ' + p.get('name') + paymentSharedStr, + currency: fromCurrencyId, + isocode: auxPay.isocode, + rate: p.get('rate'), + paymentId: p.get('paymentmethod_id'), + countInCashup: auxPay.paymentMethod.countpaymentincashup + })); + } }, this); cashUpReport.set('startings', startings); //FIXME: We are not sure if other finds are done. @@ -727,7 +751,34 @@ OB.UTIL.showLoading(true); me.set('finished', true); if (OB.MobileApp.model.hasPermission('OBPOS_print.cashup')) { - me.printCashUp.print(me.get('cashUpReport').at(0), me.getCountCashSummary(), true); + var cashUpReport = new OB.Model.CashUp(), + countCashSummary = me.getCountCashSummary(); + OB.UTIL.clone(me.get('cashUpReport').at(0), cashUpReport); + if (OB.MobileApp.model.hasPermission('OBPOS_retail.cashupRemoveUnusedPayment', true)) { + var paymentWithMovement = []; + if (OB.MobileApp.view.currentWindow !== 'retail.cashuppartial') { + OB.UTIL.cashupAddPaymentWithSummaryMovement(paymentWithMovement, countCashSummary.countedSummary); + OB.UTIL.cashupAddPaymentWithSummaryMovement(paymentWithMovement, countCashSummary.differenceSummary); + OB.UTIL.cashupAddPaymentWithSummaryMovement(paymentWithMovement, countCashSummary.qtyToKeepSummary); + OB.UTIL.cashupAddPaymentWithSummaryMovement(paymentWithMovement, countCashSummary.qtyToDepoSummary); + } + OB.UTIL.cashupAddPaymentWithSummaryMovement(paymentWithMovement, countCashSummary.expectedSummary); + OB.UTIL.cashupAddPaymentWithMovement(paymentWithMovement, cashUpReport.get('startings')); + OB.UTIL.cashupAddPaymentWithMovement(paymentWithMovement, cashUpReport.get('drops')); + OB.UTIL.cashupAddPaymentWithMovement(paymentWithMovement, cashUpReport.get('deposits')); + countCashSummary.expectedSummary = OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, countCashSummary.expectedSummary); + cashUpReport.set('startings', OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, cashUpReport.get('startings'))); + cashUpReport.set('drops', OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, cashUpReport.get('drops'))); + cashUpReport.set('deposits', OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, cashUpReport.get('deposits'))); + if (OB.MobileApp.view.currentWindow !== 'retail.cashuppartial') { + countCashSummary.countedSummary = OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, countCashSummary.countedSummary); + countCashSummary.differenceSummary = OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, countCashSummary.differenceSummary); + countCashSummary.qtyToKeepSummary = OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, countCashSummary.qtyToKeepSummary); + countCashSummary.qtyToDepoSummary = OB.UTIL.cashupGetPaymentWithMovement(paymentWithMovement, countCashSummary.qtyToDepoSummary); + } + } + + me.printCashUp.print(cashUpReport, countCashSummary, true); } }; var callbackFinishedWrongly = function () { diff --git a/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-steps.js b/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-steps.js --- a/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-steps.js +++ b/web/org.openbravo.retail.posterminal/js/closecash/model/cashup-steps.js @@ -1,6 +1,6 @@ /* ************************************************************************************ - * Copyright (C) 2013-2016 Openbravo S.L.U. + * Copyright (C) 2013-2019 Openbravo S.L.U. * Licensed under the Openbravo Commercial License version 1.0 * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html * or in the legal folder of this module distribution. @@ -93,7 +93,8 @@ return false; }, allowNext: function () { - return _.reduce(this.model.get('paymentList').models, function (allCounted, model) { + var paymentList = this.model.get(OB.MobileApp.model.hasPermission('OBPOS_retail.cashupGroupExpectedPayment', true) ? 'paymentExpectedList' : 'paymentList'); + return _.reduce(paymentList.models, function (allCounted, model) { return allCounted && model.get('counted') !== null && model.get('counted') !== undefined; }, true); }, diff --git a/web/org.openbravo.retail.posterminal/js/closecash/view/tabcountcash.js b/web/org.openbravo.retail.posterminal/js/closecash/view/tabcountcash.js --- a/web/org.openbravo.retail.posterminal/js/closecash/view/tabcountcash.js +++ b/web/org.openbravo.retail.posterminal/js/closecash/view/tabcountcash.js @@ -1,6 +1,6 @@ /* ************************************************************************************ - * Copyright (C) 2012-2017 Openbravo S.L.U. + * Copyright (C) 2012-2019 Openbravo S.L.U. * Licensed under the Openbravo Commercial License version 1.0 * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html * or in the legal folder of this module distribution. @@ -19,6 +19,7 @@ classes: 'row-fluid', components: [{ classes: 'span12', + name: 'listItem', style: 'border-bottom: 1px solid #cccccc;', components: [{ style: 'float:left; display: table; width: 50%', @@ -73,8 +74,11 @@ this.$.expected.setContent(OB.I18N.formatCurrency(OB.DEC.add(0, this.model.get('expected')))); }, render: function () { + this.inherited(arguments); + if (this.model.get('firstEmptyPayment')) { + this.$.listItem.setStyle("border-bottom: 1px solid #cccccc; border-top: 1px solid #cccccc"); + } var counted; - this.inherited(arguments); if (OB.MobileApp.model.get('permissions').OBPOS_HideCashUpInfoToCashier) { this.$.expected.hide(); this.$.foreignExpected.hide(); @@ -101,9 +105,6 @@ enyo.kind({ name: 'OB.OBPOSCashUp.UI.ListPaymentMethods', - handlers: { - onAnyCounted: 'anyCounted' - }, events: { onCountAllOK: '', onShowPopup: '' @@ -168,37 +169,6 @@ listStyle: 'list' }] }, { - components: [{ - classes: 'row-fluid', - components: [{ - classes: 'span12', - style: 'border-bottom: 1px solid #cccccc;', - components: [{ - style: 'float: left; display:table; width: 50%; ', - components: [{ - style: 'display:table-cell; width: 100%;', - content: ' ', - allowHtml: true - }] - }, { - style: 'float: left; display:table; width: 50%; ', - components: [{ - style: 'display:table-cell; width: 50px; padding: 10px 10px 10px 0px;' - }, { - style: 'display:table-cell; width: 15%;', - components: [{ - name: 'buttonAllOk', - kind: 'OB.UI.SmallButton', - classes: 'btnlink-green btnlink-cashup-ok btn-icon-small btn-icon-check', - ontap: 'doCountAllOK' - }] - }, { - // This element has been intentionally created empty. - }] - }] - }] - }] - }, { classes: 'row-fluid', style: 'background-color: #ffffff; height: 40px; width:100%; clear: both;', components: [{ @@ -240,9 +210,6 @@ setCollection: function (col) { this.$.paymentsList.setCollection(col); }, - anyCounted: function () { - this.$.buttonAllOk.applyStyle('visibility', 'hidden'); //hiding in this way to keep the space - }, displayStep: function (model) { // If the cashier is not trusty, hide expected and total amount that should be. if (OB.MobileApp.model.get('permissions').OBPOS_HideCashUpInfoToCashier) { @@ -284,6 +251,18 @@ this.model = model; // this function is invoked when going next, invokes callback to continue // do not invoke callback to cancel going next. + if (OB.MobileApp.model.hasPermission('OBPOS_retail.cashupGroupExpectedPayment', true)) { + // Auto confirm empty payment methods + _.each(model.get('paymentEmptyList').models, function (payment) { + var paymentModel = _.find(model.get('paymentList').models, function (p) { + return p.id === payment.id; + }); + if (paymentModel) { + paymentModel.set('counted', paymentModel.get('expected')); + paymentModel.set('foreignCounted', paymentModel.get('foreignExpected')); + } + }); + } var totalCashDiff = 0, cashDiff = [], me = this; diff --git a/web/org.openbravo.retail.posterminal/js/closecash/view/tabpostprintclose.js b/web/org.openbravo.retail.posterminal/js/closecash/view/tabpostprintclose.js --- a/web/org.openbravo.retail.posterminal/js/closecash/view/tabpostprintclose.js +++ b/web/org.openbravo.retail.posterminal/js/closecash/view/tabpostprintclose.js @@ -1,6 +1,6 @@ /* ************************************************************************************ - * Copyright (C) 2012-2015 Openbravo S.L.U. + * Copyright (C) 2012-2019 Openbravo S.L.U. * Licensed under the Openbravo Commercial License version 1.0 * You may obtain a copy of the License at http://www.openbravo.com/legal/obcl.html * or in the legal folder of this module distribution. @@ -559,6 +559,8 @@ }] }], + paymentWithMovement: [], + create: function () { this.inherited(arguments); this.$.store.setContent(OB.I18N.getLabel('OBPOS_LblStore') + ': ' + OB.MobileApp.model.get('terminal').organization$_identifier); @@ -594,19 +596,72 @@ }, this); }, + filterMovements: function (cashUpReport, isSummary) { + var startings, drops, deposits, expectedSummary, countedSummary, differenceSummary, qtyToKeepSummary, qtyToDepoSummary; + if (cashUpReport && OB.MobileApp.model.hasPermission('OBPOS_retail.cashupRemoveUnusedPayment', true)) { + this.paymentWithMovement = []; + if (isSummary) { + OB.UTIL.cashupAddPaymentWithSummaryMovement(this.paymentWithMovement, this.summary.expectedSummary); + if (OB.MobileApp.view.currentWindow !== 'retail.cashuppartial') { + OB.UTIL.cashupAddPaymentWithSummaryMovement(this.paymentWithMovement, this.summary.countedSummary); + OB.UTIL.cashupAddPaymentWithSummaryMovement(this.paymentWithMovement, this.summary.differenceSummary); + OB.UTIL.cashupAddPaymentWithSummaryMovement(this.paymentWithMovement, this.summary.qtyToKeepSummary); + OB.UTIL.cashupAddPaymentWithSummaryMovement(this.paymentWithMovement, this.summary.qtyToDepoSummary); + countedSummary = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, this.summary.countedSummary); + differenceSummary = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, this.summary.differenceSummary); + qtyToKeepSummary = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, this.summary.qtyToKeepSummary); + qtyToDepoSummary = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, this.summary.qtyToDepoSummary); + } + expectedSummary = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, this.summary.expectedSummary); + } else { + OB.UTIL.cashupAddPaymentWithMovement(this.paymentWithMovement, cashUpReport.get('startings')); + OB.UTIL.cashupAddPaymentWithMovement(this.paymentWithMovement, cashUpReport.get('drops')); + OB.UTIL.cashupAddPaymentWithMovement(this.paymentWithMovement, cashUpReport.get('deposits')); + startings = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, cashUpReport.get('startings')); + drops = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, cashUpReport.get('drops')); + deposits = OB.UTIL.cashupGetPaymentWithMovement(this.paymentWithMovement, cashUpReport.get('deposits')); + } + } else { + if (cashUpReport) { + startings = cashUpReport.get('startings'); + drops = cashUpReport.get('drops'); + deposits = cashUpReport.get('deposits'); + } + expectedSummary = this.summary.expectedSummary; + if (OB.MobileApp.view.currentWindow !== 'retail.cashuppartial') { + countedSummary = this.summary.countedSummary; + differenceSummary = this.summary.differenceSummary; + qtyToKeepSummary = this.summary.qtyToKeepSummary; + qtyToDepoSummary = this.summary.qtyToDepoSummary; + } + } + return { + startings: startings, + drops: drops, + deposits: deposits, + expectedSummary: expectedSummary, + countedSummary: countedSummary, + differenceSummary: differenceSummary, + qtyToKeepSummary: qtyToKeepSummary, + qtyToDepoSummary: qtyToDepoSummary + }; + }, + cashUpReportChanged: function (cashUpReport) { - this.$.startingsTable.setCollection(cashUpReport.get('startings')); + var filtered = this.filterMovements(cashUpReport, false); + this.$.startingsTable.setCollection(filtered.startings); this.$.startingsTable.setValue('totalstartings', cashUpReport.get('totalStartings')); - this.$.dropsTable.setCollection(cashUpReport.get('drops')); + this.$.dropsTable.setCollection(filtered.drops); this.$.dropsTable.setValue('totaldrops', cashUpReport.get('totalDrops')); - this.$.depositsTable.setCollection(cashUpReport.get('deposits')); + this.$.depositsTable.setCollection(filtered.deposits); this.$.depositsTable.setValue('totaldeposits', cashUpReport.get('totalDeposits')); }, summaryChanged: function () { - this.$.expectedTable.setCollection(this.summary.expectedSummary); + var filtered = this.filterMovements(this.model.get('cashUpReport').at(0), true); + this.$.expectedTable.setCollection(filtered.expectedSummary); this.$.expectedTable.setValue('totalexpected', this.summary.totalExpected); if (OB.MobileApp.view.currentWindow === 'retail.cashuppartial') { this.$.countedTable.hide(); @@ -614,21 +669,22 @@ this.$.qtyToKeepTable.hide(); this.$.qtyToDepoTable.hide(); } else { - this.$.countedTable.setCollection(this.summary.countedSummary); + this.$.countedTable.setCollection(filtered.countedSummary); this.$.countedTable.setValue('totalcounted', this.summary.totalCounted); - this.$.differenceTable.setCollection(this.summary.differenceSummary); + this.$.differenceTable.setCollection(filtered.differenceSummary); this.$.differenceTable.setValue('totaldifference', this.summary.totalDifference); - this.$.qtyToKeepTable.setCollection(this.summary.qtyToKeepSummary); + this.$.qtyToKeepTable.setCollection(filtered.qtyToKeepSummary); this.$.qtyToKeepTable.setValue('totalqtyToKeep', this.summary.totalQtyToKeep); - this.$.qtyToDepoTable.setCollection(this.summary.qtyToDepoSummary); + this.$.qtyToDepoTable.setCollection(filtered.qtyToDepoSummary); this.$.qtyToDepoTable.setValue('totalqtyToDepo', this.summary.totalQtyToDepo); } }, modelChanged: function () { + var filtered = this.filterMovements(this.model.get('cashUpReport').at(0), false); this.$.sales.setValue('netsales', this.model.get('netSales')); this.$.sales.setCollection(this.model.get('salesTaxes')); this.$.sales.setValue('totalsales', this.model.get('grossSales')); @@ -639,13 +695,13 @@ this.$.totaltransactions.setValue('totaltransactionsline', this.model.get('totalRetailTransactions')); - this.$.startingsTable.setCollection(this.model.get('startings')); + this.$.startingsTable.setCollection(filtered.startings); this.$.startingsTable.setValue('totalstartings', this.model.get('totalStartings')); - this.$.dropsTable.setCollection(this.model.get('drops')); + this.$.dropsTable.setCollection(filtered.drops); this.$.dropsTable.setValue('totaldrops', this.model.get('totalDrops')); - this.$.depositsTable.setCollection(this.model.get('deposits')); + this.$.depositsTable.setCollection(filtered.deposits); this.$.depositsTable.setValue('totaldeposits', this.model.get('totalDeposits')); this.model.on('change:time', function () { diff --git a/web/org.openbravo.retail.posterminal/js/utils/cashUpReportUtils.js b/web/org.openbravo.retail.posterminal/js/utils/cashUpReportUtils.js --- a/web/org.openbravo.retail.posterminal/js/utils/cashUpReportUtils.js +++ b/web/org.openbravo.retail.posterminal/js/utils/cashUpReportUtils.js @@ -932,4 +932,56 @@ } }); }; + + OB.UTIL.cashupAddPaymentWithMovement = function (paymentWithMovement, values) { + _.each(values, function (value) { + var searchKey = value.get('searchKey'); + var item = _.find(paymentWithMovement, function (p) { + return p.searchKey === searchKey; + }); + if (!item && value.get('paymentMethodId')) { + paymentWithMovement.push({ + searchKey: searchKey + }); + var paymentMethod = _.find(OB.MobileApp.model.get('payments'), function (p) { + return p.payment.id === value.get('paymentMethodId'); + }); + if (paymentMethod) { + searchKey = paymentMethod.payment.searchKey; + item = _.find(paymentWithMovement, function (p) { + return p.searchKey === searchKey; + }); + } + } + if (!item && value.get('amount') !== 0) { + paymentWithMovement.push({ + searchKey: searchKey + }); + } + }); + }; + + OB.UTIL.cashupAddPaymentWithSummaryMovement = function (paymentWithMovement, values) { + _.each(values, function (value) { + var item = _.find(paymentWithMovement, function (p) { + return p.searchKey === value.get('searchKey'); + }); + if (!item && value.get('value') !== 0) { + paymentWithMovement.push({ + searchKey: value.get('searchKey') + }); + } + }); + }; + + OB.UTIL.cashupGetPaymentWithMovement = function (paymentWithMovement, values) { + var filtered = _.filter(values, function (value) { + var item = _.find(paymentWithMovement, function (p) { + return p.searchKey === value.get('searchKey'); + }); + return item !== undefined; + }); + return filtered; + }; + }()); \ No newline at end of file TestSuite_I38641.diff [^] (19,594 bytes) 2019-01-30 08:30 [Show Content] [Hide Content] diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java --- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java +++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo S.L.U. - * All portions are Copyright (C) 2017-2018 Openbravo S.L.U. + * All portions are Copyright (C) 2017-2019 Openbravo S.L.U. * All Rights Reserved. * Contributor(s): ************************************************************************ @@ -1932,7 +1932,7 @@ public static TestIdConstructor LABEL_POPUP_STOCK_CONFIRMATION_TITLE = new TestIdConstructor( "bodyContent_bodymessage"); // public static TestIdConstructor BUTTON_POPUP_STOCK_CANCEL = new TestIdConstructor( - "bodyButtons_btnAction1", EnyoKind.BUTTON); // + "bodyButtons_btnAction1", EnyoKind.BUTTON); // public static TestIdConstructor LABEL_POPUP_DINAMIC_CONFIRMATION_TITLE = new TestIdConstructor( "dynamicConfirmationPopup_bodyContent_control"); // public static TestIdConstructor LABEL_POPUP_DINAMIC_CONFIRMATION_TITLE2 = new TestIdConstructor( @@ -1947,7 +1947,7 @@ "bodyButtons_modalDialogButton", EnyoKind.BUTTON); // public static TestIdConstructor BUTTON_POPUP_MODALACTION_CANCEL = new TestIdConstructor( "bodyButtons_modalDialogButton2", EnyoKind.BUTTON); // - + // Payment Provider Popup public static TestIdConstructor POPUP_MODALPAYMENT = new TestIdConstructor( "modalpayment_control"); // @@ -2361,6 +2361,19 @@ "listPaymentMethods_total"); // public static TestIdConstructor LABEL_CASHUP_TOTALCOUNTED = new TestIdConstructor( "listPaymentMethods_difference"); // + public static TestIdConstructor BUTTON_CASHUP_ROW1_OK = new TestIdConstructor( + "paymentsList_row1_buttonOk", EnyoKind.BUTTON); // + public static TestIdConstructor BUTTON_CASHUP_ROW2_OK = new TestIdConstructor( + "paymentsList_row2_buttonOk", EnyoKind.BUTTON); // + public static TestIdConstructor LABEL_CASHUP_ROW1_EXPECTED = new TestIdConstructor( + "paymentsList_row1_expected"); // + public static TestIdConstructor LABEL_CASHUP_ROW2_EXPECTED = new TestIdConstructor( + "paymentsList_row2_expected"); // + public static TestIdConstructor LABEL_CASHUP_ROW1_COUNTED = new TestIdConstructor( + "paymentsList_row1_counted"); // + public static TestIdConstructor LABEL_CASHUP_ROW2_COUNTED = new TestIdConstructor( + "paymentsList_row2_counted"); // + public static TestIdConstructor BUTTON_CASHUP_CARD_OK = new TestIdConstructor( "paymentsList_row1_buttonOk", EnyoKind.BUTTON); // public static TestIdConstructor BUTTON_CASHUP_CASH_OK = new TestIdConstructor( @@ -2479,6 +2492,10 @@ public static TestIdConstructor LABEL_CASHUP_WITHDRAWAL_CASH_LBLNAME = new TestIdConstructor( "drops_OBPOS_payment.cash_itemLbl"); // // Deposits + public static TestIdConstructor LABEL_CASHUP_DEPOSIT_CASHMGMT_CASH_100_NAME = new TestIdConstructor( + "cashMgmtDeposit0OBPOSpayment.cash100_itemLbl"); // + public static TestIdConstructor LABEL_CASHUP_DEPOSIT_CASHMGMT_CASH_100_QTY = new TestIdConstructor( + "cashMgmtDeposit0OBPOSpayment.cash100_itemQty"); // public static TestIdConstructor LABEL_CASHUP_DEPOSIT_CASHMGMT_CASH = new TestIdConstructor( "cashMgmtDeposit0OBPOS.payment.usacash70_itemQty"); // public static TestIdConstructor LABEL_CASHUP_DEPOSIT_CASHMGMT_CASH168 = new TestIdConstructor( diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I38641_AgileCashUp.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I38641_AgileCashUp.java new file mode 100644 --- /dev/null +++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I38641_AgileCashUp.java @@ -0,0 +1,362 @@ +/* + ************************************************************************* + * The contents of this file are subject to the Openbravo Public License + * Version 1.0 (the "License"), being the Mozilla Public License + * Version 1.1 with a permitted attribution clause; you may not use this + * file except in compliance with the License. You may obtain a copy of + * the License at http://www.openbravo.com/legal/license.html + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + * License for the specific language governing rights and limitations + * under the License. + * The Original Code is Openbravo ERP. + * The Initial Developer of the Original Code is Openbravo S.L.U. + * All portions are Copyright (C) 2019 Openbravo S.L.U. + * All Rights Reserved. + * Contributor(s): + ************************************************************************ + * + * @author EBE + * + */ + +package org.openbravo.test.mobile.retail.pack.selenium.tests.cashup; + +import org.junit.Test; +import org.openbravo.test.mobile.retail.mobilecore.annotations.TestClassAnnotations; +import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperInsertUpdateOrDelete; +import org.openbravo.test.mobile.retail.mobilecore.selenium.TestIdConstructor; +import org.openbravo.test.mobile.retail.pack.API.WebPOSAPI; +import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack; +import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper; + +@TestClassAnnotations(isHighVolumeCompatible = true) +public class I38641_AgileCashUp extends WebPOSTerminalHelper { + + @Test + public void payWithCashAndUSACash() { + // Create a ticket and pay with Cash + addAvalancheTransceiver(); + payTicket(TestIdPack.BUTTON_PAYMENT_CASH); + + // Create a ticket and pay with USA Cash + addHeadlampUltralight(); + payTicket(TestIdPack.BUTTON_PAYMENT_USACASH); + + // CashUp + tap(TestIdPack.BUTTON_MENU); + tap(TestIdPack.BUTTON_MENU_CASHUP); + + // step 1 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP2_TITLE, "Step 1 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "150.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "0.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "-150.50"); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_050); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "150.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "150.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "0.00"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 2 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP3_TITLE, "Step 2 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_ROW1_COUNTED, "150.50"); + verify(TestIdPack.LABEL_CASHUP_ROW2_EXPECTED, "18.90"); + tap(TestIdPack.BUTTON_CASHUP_ROW2_OK); + verify(TestIdPack.LABEL_CASHUP_ROW2_COUNTED, "18.90"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 3 of 4 + selectNothingToKeep(); + + // step 4 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP5_TITLE, "Step 4 of 4: Post, print and close"); + verify(TestIdPack.LABEL_CASHUP_POSTPRINTANDCLOSE, "Post, Print & Close"); + verify(TestIdPack.LABEL_CASHUP_STARTING_CASH, "0.00"); + verify(TestIdPack.LABEL_CASHUP_STARTING_CASHUSA, "0.00"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_CASH, "150.50"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_CASHUSA, "18.90"); + tap(TestIdPack.BUTTON_CASHUP_POSTPRINTANDCLOSE); + + // done + verify(TestIdPack.LABEL_POPUP_TITLE, "Good job!"); + tap(TestIdPack.BUTTON_POPUP_OK); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + } + + @Test + public void payWithCashAndMakeDeposit() { + // Create a ticket and pay with Cash + addAvalancheTransceiver(); + payTicket(TestIdPack.BUTTON_PAYMENT_CASH); + + // Cash Management + tap(TestIdPack.BUTTON_MENU); + tap(TestIdPack.BUTTON_MENU_CASHMANAGEMENT); + verify(TestIdPack.LABEL_CASHMANAGEMENT_TITLE, "Cash Management"); + WebPOSAPI.tapKeypad(this, 100); + tap(TestIdPack.BUTTON_CASHMANAGEMENT_CASHDEPOSIT); + verify(TestIdPack.LABEL_SELECTDEPOSIT_BACOFFICEVBS, "Backoffice transfer to VBS"); + tap(TestIdPack.BUTTON_SELECTDEPOSIT_BACOFFICEVBS); + verify(TestIdPack.LABEL_CASHMANAGEMENT_ROW1_AMOUNT, "100.00"); + verify(TestIdPack.LABEL_CASHMANAGEMENT_ROW1_DESCRIPTION, + "Deposit: Cash - Backoffice transfer to VBS"); + tap(TestIdPack.BUTTON_CASHMANAGEMENT_DONE); + verify(TestIdPack.LABEL_POPUP_TITLE, "Done"); + tap(TestIdPack.BUTTON_POPUP_OK); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + + // CashUp + tap(TestIdPack.BUTTON_MENU); + tap(TestIdPack.BUTTON_MENU_CASHUP); + + // step 1 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP2_TITLE, "Step 1 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "250.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "0.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "-250.50"); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_050); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "250.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "250.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "0.00"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 2 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP3_TITLE, "Step 2 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_ROW1_COUNTED, "250.50"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 3 of 4 + selectNothingToKeep(); + + // step 4 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP5_TITLE, "Step 4 of 4: Post, print and close"); + verify(TestIdPack.LABEL_CASHUP_POSTPRINTANDCLOSE, "Post, Print & Close"); + verify(TestIdPack.LABEL_CASHUP_STARTING_CASH, "0.00"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_CASHMGMT_CASH_100_NAME, + "Cash - Backoffice transfer to VBS"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_CASHMGMT_CASH_100_QTY, "100.00"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_CASH, "150.50"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_TOTAL, "250.50"); + tap(TestIdPack.BUTTON_CASHUP_POSTPRINTANDCLOSE); + + // done + verify(TestIdPack.LABEL_POPUP_TITLE, "Good job!"); + tap(TestIdPack.BUTTON_POPUP_OK); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + } + + @Test + public void payWithCardAndStartingCash() { + // + // First CashUp + // + + // Create a ticket and pay with Cash + addAvalancheTransceiver(); + payTicket(TestIdPack.BUTTON_PAYMENT_CASH); + + // CashUp + tap(TestIdPack.BUTTON_MENU); + tap(TestIdPack.BUTTON_MENU_CASHUP); + + // step 1 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP2_TITLE, "Step 1 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "150.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "0.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "-150.50"); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_050); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "150.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "150.50"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "0.00"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 2 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP3_TITLE, "Step 2 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_ROW1_COUNTED, "150.50"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 3 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE, "Step 3 of 4: Select Cash to keep"); + tap(TestIdPack.BUTTON_CASHUP_KEEPVARIABLEAMOUNT); + WebPOSAPI.tapKeypad(this, 100); + tap(TestIdPack.BUTTON_KEYPAD_ENTER); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + selectNothingToKeepUsaCash(); + selectNothingToKeepVoucher(); + + // step 4 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP5_TITLE, "Step 4 of 4: Post, print and close"); + verify(TestIdPack.LABEL_CASHUP_POSTPRINTANDCLOSE, "Post, Print & Close"); + verify(TestIdPack.LABEL_CASHUP_STARTING_CASH, "0.00"); + verify(TestIdPack.LABEL_CASHUP_TOTALTOKEEP_CASH, "100.00"); + verify(TestIdPack.LABEL_CASHUP_TOTALTOKEEP_TOTAL, "100.00"); + verify(TestIdPack.LABEL_CASHUP_TOTALTODEPOSIT_TOTAL, "50.50"); + tap(TestIdPack.BUTTON_CASHUP_POSTPRINTANDCLOSE); + + // done + verify(TestIdPack.LABEL_POPUP_TITLE, "Good job!"); + tap(TestIdPack.BUTTON_POPUP_OK); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + + // + // Second CashUp + // + + // Create a ticket and pay with Card + addAvalancheTransceiver(); + payTicket(TestIdPack.BUTTON_PAYMENT_CARD); + + // CashUp + tap(TestIdPack.BUTTON_MENU); + tap(TestIdPack.BUTTON_MENU_CASHUP); + + // step 1 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP2_TITLE, "Step 1 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "100.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "0.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "-100.00"); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + tap(TestIdPack.BUTTON_CASHUP_COUNTCASH_50); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_TOTAL, "100.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_COUNTED, "100.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTCASH_REMAINING, "0.00"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 2 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP3_TITLE, "Step 2 of 4: Count Cash"); + verify(TestIdPack.LABEL_CASHUP_ROW2_COUNTED, "100.00"); + verify(TestIdPack.LABEL_CASHUP_ROW1_EXPECTED, "150.50"); + tap(TestIdPack.BUTTON_CASHUP_ROW1_OK); + verify(TestIdPack.LABEL_CASHUP_ROW1_COUNTED, "150.50"); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + + // step 3 of 4 + selectNothingToKeep(); + + // step 4 of 4 + verify(TestIdPack.LABEL_CASHUP_STEP5_TITLE, "Step 4 of 4: Post, print and close"); + verify(TestIdPack.LABEL_CASHUP_POSTPRINTANDCLOSE, "Post, Print & Close"); + verify(TestIdPack.LABEL_CASHUP_STARTING_CASH, "100.00"); + verify(TestIdPack.LABEL_CASHUP_DEPOSIT_CARD, "150.50"); + verify(TestIdPack.LABEL_CASHUP_TOTALTOKEEP_TOTAL, "0.00"); + verify(TestIdPack.LABEL_CASHUP_COUNTED_TOTAL, "250.50"); + verify(TestIdPack.LABEL_CASHUP_TOTALTODEPOSIT_TOTAL, "250.50"); + tap(TestIdPack.BUTTON_CASHUP_POSTPRINTANDCLOSE); + + // done + verify(TestIdPack.LABEL_POPUP_TITLE, "Good job!"); + tap(TestIdPack.BUTTON_POPUP_OK); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + } + + @Override + public void beforeWithReload() { + setPreferences(); + super.beforeWithReload(); + } + + @Override + public void afterWithReload() { + clearPreferences(); + super.afterWithReload(); + } + + private void selectNothingToKeep() { + selectNothingToKeepCash(); + selectNothingToKeepUsaCash(); + selectNothingToKeepVoucher(); + } + + private void selectNothingToKeepCash() { + // cash + verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE, "Step 3 of 4: Select Cash to keep"); + verify(TestIdPack.LABEL_CASHUP_KEEPNOTHING, "Nothing"); + tap(TestIdPack.BUTTON_CASHUP_KEEPNOTHING); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + } + + private void selectNothingToKeepUsaCash() { + // usa cash + verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE, "Step 3 of 4: Select USA Cash to keep"); + verify(TestIdPack.LABEL_CASHUP_KEEPNOTHING, "Nothing"); + tap(TestIdPack.BUTTON_CASHUP_KEEPNOTHING); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + } + + private void selectNothingToKeepVoucher() { + // voucher + verify(TestIdPack.LABEL_CASHUP_STEP4_TITLE, "Step 3 of 4: Select Voucher to keep"); + verify(TestIdPack.LABEL_CASHUP_KEEPNOTHING, "Nothing"); + tap(TestIdPack.BUTTON_CASHUP_KEEPNOTHING); + tap(TestIdPack.BUTTON_CASHUP_NEXT); + } + + private void payTicket(TestIdConstructor paymentMethod) { + tap(TestIdPack.BUTTON_PAY); + tap(paymentMethod); + tap(TestIdPack.BUTTON_PAY_EXACT); + tap(TestIdPack.BUTTON_PAY_DONE); + verify(TestIdPack.LABEL_TOTALTOPAY, "0.00"); + } + + private void addAvalancheTransceiver() { + tap(TestIdPack.BUTTON_SEARCH); + write(TestIdPack.FIELD_SEARCH_TEXT, + TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER.getRowName()); + tap(TestIdPack.BUTTON_SEARCH_EXECUTE); + tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER); + verify(TestIdPack.LABEL_TOTALTOPAY, "150.50"); + } + + private void addHeadlampUltralight() { + tap(TestIdPack.BUTTON_SEARCH); + write(TestIdPack.FIELD_SEARCH_TEXT, + TestIdPack.BUTTON_SEARCHPRODUCT_HEADLAMPULTRALIGHT.getRowName()); + tap(TestIdPack.BUTTON_SEARCH_EXECUTE); + tap(TestIdPack.BUTTON_SEARCHPRODUCT_HEADLAMPULTRALIGHT); + verify(TestIdPack.LABEL_TOTALTOPAY, "18.90"); + } + + private void setPreferences() { + // Verifying OBPOS_retail.cashupGroupExpectedPayment have set Y for Vall Blanca Store User + new DatabaseHelperInsertUpdateOrDelete( + "Insert Preference OBPOS_retail.cashupGroupExpectedPayment for Vall Blanca Store User") + .execute( + "INSERT INTO ad_preference(ad_preference_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, ad_user_id, value, property, ispropertylist, selected) " + + "VALUES ('4C01157A3E5B31641C0D6BAE88F4C871', '39363B0921BB4293B48383844325E84C', '0', 'Y', now(), '100', now(), '100', '3073EDF96A3C42CC86C7069E379522D2', 'Y', 'OBPOS_retail.cashupGroupExpectedPayment', 'Y', 'N')", + 1); + // Verifying OBPOS_retail.cashupRemoveUnusedPayment have set Y for Vall Blanca Store User + new DatabaseHelperInsertUpdateOrDelete( + "Insert Preference OBPOS_retail.cashupRemoveUnusedPayment for Vall Blanca Store User") + .execute( + "INSERT INTO ad_preference(ad_preference_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby, ad_user_id, value, property, ispropertylist, selected) " + + "VALUES ('9AA1A1F855CA2D06976A26C04FC582B0', '39363B0921BB4293B48383844325E84C', '0', 'Y', now(), '100', now(), '100', '3073EDF96A3C42CC86C7069E379522D2', 'Y', 'OBPOS_retail.cashupRemoveUnusedPayment', 'Y', 'N')", + 1); + } + + private void clearPreferences() { + new DatabaseHelperInsertUpdateOrDelete( + "Remove existing OBPOS_retail.cashupGroupExpectedPayment for Vall Blanca Store User") + .execute( + "DELETE from AD_Preference WHERE property = 'OBPOS_retail.cashupGroupExpectedPayment' and ad_user_id = '3073EDF96A3C42CC86C7069E379522D2'", + 1); + new DatabaseHelperInsertUpdateOrDelete( + "Remove existing OBPOS_retail.cashupRemoveUnusedPayment for Vall Blanca Store User") + .execute( + "DELETE from AD_Preference WHERE property = 'OBPOS_retail.cashupRemoveUnusedPayment' and ad_user_id = '3073EDF96A3C42CC86C7069E379522D2'", + 1); + } + +} | |||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |
Notes | |
(0109682) hgbot (developer) 2019-02-12 10:27 |
Repository: erp/pmods/org.openbravo.retail.posterminal Changeset: dc29a8fe7ce166b782772d3f3791176e55aabd9a Author: Eduardo Becerra <ebec70 <at> yahoo.com> Date: Tue Feb 12 10:26:07 2019 +0100 URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/dc29a8fe7ce166b782772d3f3791176e55aabd9a [^] Fix issue 38641: Improvement in Cash Up in the "Count Cash" and "Post, Print & Close" steps --- M src-db/database/sourcedata/AD_PREFERENCE.xml M src-db/database/sourcedata/AD_REF_LIST.xml M src/org/openbravo/retail/posterminal/ad_reports/CashUpReport.java M web/org.openbravo.retail.posterminal/css/obpos-main.css M web/org.openbravo.retail.posterminal/js/closecash/model/cashup-model.js M web/org.openbravo.retail.posterminal/js/closecash/model/cashup-steps.js M web/org.openbravo.retail.posterminal/js/closecash/view/tabcountcash.js M web/org.openbravo.retail.posterminal/js/closecash/view/tabpostprintclose.js M web/org.openbravo.retail.posterminal/js/utils/cashUpReportUtils.js --- |
(0109683) hgbot (developer) 2019-02-12 10:31 |
Repository: tools/automation/pi-mobile Changeset: afe409e21659499cf130ae487a1bbc378def1aae Author: Eduardo Becerra <ebec70 <at> yahoo.com> Date: Tue Feb 12 10:30:36 2019 +0100 URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/afe409e21659499cf130ae487a1bbc378def1aae [^] Related issue 38641: Test suite --- M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/selfcheckout/SCOCashup.java M src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I38641_AgileCashUp.java --- |
Issue History | |||
Date Modified | Username | Field | Change |
2018-05-28 11:57 | ebecerra | New Issue | |
2018-05-28 11:57 | ebecerra | Assigned To | => Retail |
2018-05-28 11:57 | ebecerra | Triggers an Emergency Pack | => No |
2018-06-08 12:50 | ebecerra | File Added: I38641_test.diff | |
2019-01-21 08:55 | ebecerra | File Added: posterminal.diff | |
2019-01-22 12:01 | ebecerra | File Deleted: I38641_test.diff | |
2019-01-22 12:01 | ebecerra | File Added: TestSuite_I38641.diff | |
2019-01-22 12:03 | ebecerra | File Deleted: TestSuite_I38641.diff | |
2019-01-22 12:03 | ebecerra | File Added: TestSuite_I38641.diff | |
2019-01-22 12:11 | ebecerra | File Deleted: posterminal.diff | |
2019-01-22 12:12 | ebecerra | File Added: posterminal.diff | |
2019-01-23 17:03 | ebecerra | File Deleted: posterminal.diff | |
2019-01-23 17:04 | ebecerra | File Added: posterminal.diff | |
2019-01-25 09:09 | ebecerra | File Deleted: posterminal.diff | |
2019-01-25 09:09 | ebecerra | File Added: posterminal.diff | |
2019-01-29 13:50 | ebecerra | File Deleted: TestSuite_I38641.diff | |
2019-01-29 13:52 | ebecerra | File Added: TestSuite_I38641.diff | |
2019-01-30 08:29 | ebecerra | File Deleted: TestSuite_I38641.diff | |
2019-01-30 08:30 | ebecerra | File Added: TestSuite_I38641.diff | |
2019-02-12 10:27 | hgbot | Checkin | |
2019-02-12 10:27 | hgbot | Note Added: 0109682 | |
2019-02-12 10:31 | hgbot | Checkin | |
2019-02-12 10:31 | hgbot | Note Added: 0109683 | |
2019-03-27 18:46 | marvintm | Status | new => scheduled |
2019-03-27 18:46 | marvintm | Status | scheduled => resolved |
2019-03-27 18:46 | marvintm | Fixed in Version | => RR19Q2 |
2019-03-27 18:46 | marvintm | Resolution | open => fixed |
2019-03-27 18:47 | marvintm | Review Assigned To | => marvintm |
2019-03-27 18:47 | marvintm | Status | resolved => closed |
Copyright © 2000 - 2009 MantisBT Group |