eason.qian 7 years ago
parent a02ba16a8c
commit 481fa42eb5

@ -1051,10 +1051,25 @@ public class RetailAppServiceImp implements RetailAppService {
throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone); throw new BadRequestException("No Transactions in date " + dateStr + " at " + timezone);
} }
TimeZoneUtils.switchTimeZoneToString(transactions, timezone, "HH:mm:ss", Collections.singletonList("transaction_time")); TimeZoneUtils.switchTimeZoneToString(transactions, timezone, "HH:mm:ss", Collections.singletonList("transaction_time"));
BigDecimal display_amount = BigDecimal.ZERO;
BigDecimal cny_display_amount = BigDecimal.ZERO;
for (JSONObject transaction:transactions){
if (PlatformEnvironment.getEnv().getForeignCurrency().equals(transaction.getString("currency"))){
if ("Credit".equals(transaction.getString("transaction_type"))){
display_amount = display_amount.add(transaction.getBigDecimal("display_amount"));
}
}else {
if ("Credit".equals(transaction.getString("transaction_type"))){
cny_display_amount = cny_display_amount.add(transaction.getBigDecimal("cny_display_amount"));
}
}
}
JSONObject res = new JSONObject(); JSONObject res = new JSONObject();
res.put("transactions", transactions); res.put("transactions", transactions);
JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id")); JSONObject analysis = transactionMapper.analysisRetailDailyReport(date, to, devId, device.getIntValue("client_id"));
analysis.put("date", TimeZoneUtils.formatTime(date, "dd/MMM/yyyy", timezone)); analysis.put("date", TimeZoneUtils.formatTime(date, "dd/MMM/yyyy", timezone));
analysis.put("display_amount",display_amount);
analysis.put("cny_display_amount",cny_display_amount);
res.put("analysis", analysis); res.put("analysis", analysis);
return res; return res;
} catch (ParseException e) { } catch (ParseException e) {

@ -668,7 +668,12 @@
<![CDATA[ <![CDATA[
SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total_credit, SELECT sum(if(t.transaction_type='Credit',t.clearing_amount,0)) total_credit,
sum(if(t.transaction_type='Debit',t.clearing_amount,0)) total_debit, sum(if(t.transaction_type='Debit',t.clearing_amount,0)) total_debit,
sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)) gross_amount sum(if(t.transaction_type='Credit',t.clearing_amount,-t.clearing_amount)) gross_amount,
count(t.transaction_id) order_count,
sum(if(t.transaction_type='Credit',t.settle_amount,-t.settle_amount)) total_settle_amount,
sum(if(t.transaction_type='Credit',t.total_surcharge,-t.total_surcharge)) total_surcharge,
sum(if(t.transaction_type='Credit',t.tax_amount,-t.tax_amount)) tax_amount
FROM pmt_transactions t FROM pmt_transactions t
WHERE t.transaction_time>=#{from} and t.transaction_time<#{to} and (t.transaction_type='Credit' or t.refund_id is not null) WHERE t.transaction_time>=#{from} and t.transaction_time<#{to} and (t.transaction_type='Credit' or t.refund_id is not null)
and t.client_id=#{client_id} and t.client_id=#{client_id}

@ -36,3 +36,12 @@
<button type="button" class="btn btn-success" ng-click="submit()">OK</button> <button type="button" class="btn btn-success" ng-click="submit()">OK</button>
<button type="button" class="btn btn-danger" ng-click="$dismiss()">Cancel</button> <button type="button" class="btn btn-danger" ng-click="$dismiss()">Cancel</button>
</div> </div>
<div id="bg" ng-if="saveNoticeResult"></div>
<div id="show" ng-if="saveNoticeResult">
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0"
aria-valuemax="100" style="width: 100%">
<span class="sr-only">We are saving...</span>
</div>
</div>
</div>
Loading…
Cancel
Save