paymentdialog.init(m_App);
paymentdialog.setPrintSelected(true);
if (paymentdialog.showDialog(currentCustomer.getCurdebt(), currentCustomer, null, null)) {
DataLogicSales dlsales = (DataLogicSales) m_App.getBean("com.openbravo.pos.forms.DataLogicSales");
TicketInfo ticket = new TicketInfo();
ticket.setTicketType(TicketInfo.RECEIPT_PAYMENT);
List<PaymentInfo> payments = paymentdialog.getSelectedPayments();
double total = 0.0;
for (PaymentInfo p : payments) {
total += p.getTotal();
}
payments.add(new PaymentInfoTicket(-total, "debtpaid"));
ticket.setPayments(payments);
ticket.setUser(m_App.getAppUserView().getUser().getUserInfo());
ticket.setActiveCash(m_App.getActiveCashIndex());
ticket.setDate(new Date());
ticket.setCustomer(currentCustomer);
ticket.setDateReturn(paymentdialog.getrDate());
try {
dlsales.saveTicket(ticket, m_App.getInventoryLocation());
} catch (BasicException eData) {
MessageInf msg = new MessageInf(MessageInf.SGN_NOTICE, AppLocal.getIntString("message.nosaveticket"), eData);
msg.show(this);
}
// reload customer
CustomerInfoExt c;
try {
c = dlsales.loadCustomerExt(currentCustomer.getId());
if (c == null) {
MessageInf msg = new MessageInf(MessageInf.SGN_WARNING, AppLocal.getIntString("message.cannotfindcustomer"));
msg.show(this);
} else {
// editCustomer(c);