Merge release-7.1 into master
This commit is contained in:
commit
2642293c0a
|
@ -973,12 +973,11 @@ public class Doc_AllocationHdr extends Doc
|
|||
List<Object> valuesPay = DB.getSQLValueObjectsEx(getTrxName(), sql.toString(),
|
||||
MPayment.Table_ID, payment.getC_Payment_ID(), as.getC_AcctSchema_ID(), acct.getAccount_ID());
|
||||
if (valuesPay != null) {
|
||||
if (payment.isReceipt()) {
|
||||
paymentSource = (BigDecimal) valuesPay.get(0); // AmtSourceDr
|
||||
paymentAccounted = (BigDecimal) valuesPay.get(1); // AmtAcctDr
|
||||
if (paymentSource.signum() == 0 && paymentAccounted.signum() == 0) {
|
||||
paymentSource = (BigDecimal) valuesPay.get(2); // AmtSourceCr
|
||||
paymentAccounted = (BigDecimal) valuesPay.get(3); // AmtAcctCr
|
||||
} else {
|
||||
paymentSource = (BigDecimal) valuesPay.get(0); // AmtSourceDr
|
||||
paymentAccounted = (BigDecimal) valuesPay.get(1); // AmtAcctDr
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -995,7 +994,7 @@ public class Doc_AllocationHdr extends Doc
|
|||
// Full Payment in currency
|
||||
if (allocationSource.abs().compareTo(paymentSource.abs()) == 0)
|
||||
{
|
||||
acctDifference = totalAllocationAccounted.subtract(paymentAccounted.abs()); // gain is negative
|
||||
acctDifference = totalAllocationAccounted.abs().subtract(paymentAccounted.abs()); // gain is negative
|
||||
StringBuilder d2 = new StringBuilder("(full) = ").append(acctDifference);
|
||||
if (log.isLoggable(Level.FINE)) log.fine(d2.toString());
|
||||
description.append(" - ").append(d2);
|
||||
|
@ -1016,6 +1015,46 @@ public class Doc_AllocationHdr extends Doc
|
|||
paymentAccounted0.abs().compareTo(totalAllocationAccounted.abs()) == 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// percent of total payment
|
||||
double multiplier = allocationSource.doubleValue() / paymentSource.doubleValue();
|
||||
// Reduce Orig Payment Accounted
|
||||
paymentAccounted = paymentAccounted.multiply(BigDecimal.valueOf(multiplier));
|
||||
// Difference based on percentage of Orig Payment
|
||||
acctDifference = totalAllocationAccounted.abs().subtract(paymentAccounted.abs()); // gain is negative
|
||||
// ignore Tolerance
|
||||
if (acctDifference.abs().compareTo(TOLERANCE) < 0)
|
||||
acctDifference = Env.ZERO;
|
||||
// Round
|
||||
int precision = as.getStdPrecision();
|
||||
if (acctDifference.scale() > precision)
|
||||
acctDifference = acctDifference.setScale(precision, RoundingMode.HALF_UP);
|
||||
StringBuilder d2 = new StringBuilder("(partial) = ").append(acctDifference).append(" - Multiplier=").append(multiplier);
|
||||
if (log.isLoggable(Level.FINE)) log.fine(d2.toString());
|
||||
description.append(" - ").append(d2);
|
||||
|
||||
// Different period
|
||||
if (MPeriod.getC_Period_ID(getCtx(), payment.getDateAcct(), payment.getAD_Org_ID()) !=
|
||||
MPeriod.getC_Period_ID(getCtx(), getDateAcct(), getAD_Org_ID()))
|
||||
{
|
||||
if (paymentAccounted.scale() > precision)
|
||||
paymentAccounted = paymentAccounted.setScale(precision, RoundingMode.HALF_UP);
|
||||
paymentSource = paymentSource.multiply(BigDecimal.valueOf(multiplier));
|
||||
if (paymentSource.scale() > precision)
|
||||
paymentSource = paymentSource.setScale(precision, RoundingMode.HALF_UP);
|
||||
BigDecimal allocationAccounted0 = MConversionRate.convert(getCtx(),
|
||||
allocationSource, getC_Currency_ID(),
|
||||
as.getC_Currency_ID(), payment.getDateAcct(),
|
||||
payment.getC_ConversionType_ID(), payment.getAD_Client_ID(), payment.getAD_Org_ID());
|
||||
BigDecimal paymentAccounted0 = MConversionRate.convert(getCtx(),
|
||||
paymentSource, getC_Currency_ID(),
|
||||
as.getC_Currency_ID(), getDateAcct(),
|
||||
getC_ConversionType_ID(), getAD_Client_ID(), getAD_Org_ID());
|
||||
isSameSourceDiffPeriod = allocationAccounted0.abs().compareTo(paymentAccounted.abs()) == 0 &&
|
||||
paymentAccounted0.abs().compareTo(totalAllocationAccounted.abs()) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (acctDifference == null || acctDifference.signum() == 0)
|
||||
{
|
||||
|
|
|
@ -25,9 +25,12 @@ import org.compiere.model.MImage;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.zkoss.image.AImage;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Cell;
|
||||
import org.zkoss.zul.Image;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +56,21 @@ public class WImageEditor extends WEditor
|
|||
|
||||
public WImageEditor(GridField gridField)
|
||||
{
|
||||
super(new Image(), gridField);
|
||||
super(new Image() {
|
||||
private static final long serialVersionUID = 8492629361709791256L;
|
||||
|
||||
@Override
|
||||
public void onPageAttached(Page newpage, Page oldpage) {
|
||||
super.onPageAttached(newpage, oldpage);
|
||||
if (newpage != null && getParent() != null) {
|
||||
Component p = getParent();
|
||||
if (p instanceof Cell) {
|
||||
Cell cell = (Cell) p;
|
||||
LayoutUtils.addSclass("image-field-cell", cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, gridField);
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -66,7 +83,7 @@ public class WImageEditor extends WEditor
|
|||
{
|
||||
AImage img = null;
|
||||
getComponent().setContent(img);
|
||||
getComponent().setSclass("image-field");
|
||||
getComponent().setSclass("image-field image-fit-contain");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -140,7 +140,7 @@ public class SchedulerStateEditor extends WEditor {
|
|||
}
|
||||
|
||||
private int getAD_Scheduler_ID() {
|
||||
return gridTab.getRecord_ID();
|
||||
return gridTab != null ? gridTab.getRecord_ID() : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,7 +152,7 @@ public class SchedulerStateEditor extends WEditor {
|
|||
if (schedulerState == AdempiereServerMgr.SERVER_STATE_NOT_SCHEDULE) {
|
||||
ADWindow adwindow = ADWindow.findADWindow(getComponent());
|
||||
if (adwindow != null) {
|
||||
if (gridTab.isNew() || gridTab.needSave(false, false)) {
|
||||
if (gridTab != null && (gridTab.isNew() || gridTab.needSave(false, false))) {
|
||||
adwindow.getADWindowContent().onSave(true, false, new Callback<Boolean>() {
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
|
@ -171,7 +171,7 @@ public class SchedulerStateEditor extends WEditor {
|
|||
} else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STARTED) {
|
||||
ADWindow adwindow = ADWindow.findADWindow(getComponent());
|
||||
if (adwindow != null) {
|
||||
if (gridTab.isNew() || gridTab.needSave(false, false)) {
|
||||
if (gridTab != null && (gridTab.isNew() || gridTab.needSave(false, false))) {
|
||||
adwindow.getADWindowContent().onSave(true, false, new Callback<Boolean>() {
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
|
@ -186,7 +186,7 @@ public class SchedulerStateEditor extends WEditor {
|
|||
} else if (schedulerState == AdempiereServerMgr.SERVER_STATE_STOPPED) {
|
||||
ADWindow adwindow = ADWindow.findADWindow(getComponent());
|
||||
if (adwindow != null) {
|
||||
if (gridTab.isNew() || gridTab.needSave(false, false)) {
|
||||
if (gridTab != null && (gridTab.isNew() || gridTab.needSave(false, false))) {
|
||||
adwindow.getADWindowContent().onSave(true, false, new Callback<Boolean>() {
|
||||
@Override
|
||||
public void onCallback(Boolean result) {
|
||||
|
@ -261,7 +261,7 @@ public class SchedulerStateEditor extends WEditor {
|
|||
*/
|
||||
@Override
|
||||
public void setReadWrite(boolean readWrite) {
|
||||
GridField descriptionField = gridTab.getField("Description");
|
||||
GridField descriptionField = gridTab != null ? gridTab.getField("Description") : null;
|
||||
if (descriptionField != null)
|
||||
getComponent().setEnabled(descriptionField.isEditable(true));
|
||||
else
|
||||
|
|
|
@ -205,6 +205,7 @@ public class WImageDialog extends Window implements EventListener<Event>
|
|||
ZKUpdateUtil.setHflex(image, "true");
|
||||
ZKUpdateUtil.setVflex(image, "true");
|
||||
center.setParent(mainLayout);
|
||||
image.setSclass("image-fit-contain");
|
||||
center.appendChild(image);
|
||||
|
||||
South south = new South();
|
||||
|
|
|
@ -93,7 +93,6 @@ public class WLocationDialog extends Window implements EventListener<Event>
|
|||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -9116270523919373406L;
|
||||
private static final String LABEL_STYLE = "white-space: nowrap;";
|
||||
/** Logger */
|
||||
private static final CLogger log = CLogger.getCLogger(WLocationDialog.class);
|
||||
private Label lblAddress1;
|
||||
|
@ -228,29 +227,29 @@ public class WLocationDialog extends Window implements EventListener<Event>
|
|||
private void initComponents()
|
||||
{
|
||||
lblAddress1 = new Label(Msg.getElement(Env.getCtx(), "Address1"));
|
||||
lblAddress1.setStyle(LABEL_STYLE);
|
||||
lblAddress1.setSclass("field-label");
|
||||
lblAddress2 = new Label(Msg.getElement(Env.getCtx(), "Address2"));
|
||||
lblAddress2.setStyle(LABEL_STYLE);
|
||||
lblAddress2.setSclass("field-label");
|
||||
lblAddress3 = new Label(Msg.getElement(Env.getCtx(), "Address3"));
|
||||
lblAddress3.setStyle(LABEL_STYLE);
|
||||
lblAddress3.setSclass("field-label");
|
||||
lblAddress4 = new Label(Msg.getElement(Env.getCtx(), "Address4"));
|
||||
lblAddress4.setStyle(LABEL_STYLE);
|
||||
lblAddress4.setSclass("field-label");
|
||||
lblAddress5 = new Label(Msg.getElement(Env.getCtx(), "Address5"));
|
||||
lblAddress5.setStyle(LABEL_STYLE);
|
||||
lblAddress5.setSclass("field-label");
|
||||
lblComments = new Label(Msg.getElement(Env.getCtx(), "Comments"));
|
||||
lblComments.setStyle(LABEL_STYLE);
|
||||
lblComments.setSclass("field-label");
|
||||
lblCity = new Label(Msg.getMsg(Env.getCtx(), "City"));
|
||||
lblCity.setStyle(LABEL_STYLE);
|
||||
lblCity.setSclass("field-label");
|
||||
lblZip = new Label(Msg.getMsg(Env.getCtx(), "Postal"));
|
||||
lblZip.setStyle(LABEL_STYLE);
|
||||
lblZip.setSclass("field-label");
|
||||
lblRegion = new Label(Msg.getMsg(Env.getCtx(), "Region"));
|
||||
lblRegion.setStyle(LABEL_STYLE);
|
||||
lblRegion.setSclass("field-label");
|
||||
lblPostal = new Label(Msg.getMsg(Env.getCtx(), "Postal"));
|
||||
lblPostal.setStyle(LABEL_STYLE);
|
||||
lblPostal.setSclass("field-label");
|
||||
lblPostalAdd = new Label(Msg.getMsg(Env.getCtx(), "PostalAdd"));
|
||||
lblPostalAdd.setStyle(LABEL_STYLE);
|
||||
lblPostalAdd.setSclass("field-label");
|
||||
lblCountry = new Label(Msg.getMsg(Env.getCtx(), "Country"));
|
||||
lblCountry.setStyle(LABEL_STYLE);
|
||||
lblCountry.setSclass("field-label");
|
||||
|
||||
txtAddress1 = new Textbox();
|
||||
txtAddress1.setCols(20);
|
||||
|
@ -351,57 +350,57 @@ public class WLocationDialog extends Window implements EventListener<Event>
|
|||
ZKUpdateUtil.setWidth(column, "70%");
|
||||
|
||||
Row pnlAddress1 = new Row();
|
||||
pnlAddress1.appendChild(lblAddress1.rightAlign());
|
||||
pnlAddress1.appendChild(lblAddress1);
|
||||
pnlAddress1.appendChild(txtAddress1);
|
||||
ZKUpdateUtil.setHflex(txtAddress1, "1");
|
||||
|
||||
Row pnlAddress2 = new Row();
|
||||
pnlAddress2.appendChild(lblAddress2.rightAlign());
|
||||
pnlAddress2.appendChild(lblAddress2);
|
||||
pnlAddress2.appendChild(txtAddress2);
|
||||
ZKUpdateUtil.setHflex(txtAddress2, "1");
|
||||
|
||||
Row pnlAddress3 = new Row();
|
||||
pnlAddress3.appendChild(lblAddress3.rightAlign());
|
||||
pnlAddress3.appendChild(lblAddress3);
|
||||
pnlAddress3.appendChild(txtAddress3);
|
||||
ZKUpdateUtil.setHflex(txtAddress3, "1");
|
||||
|
||||
Row pnlAddress4 = new Row();
|
||||
pnlAddress4.appendChild(lblAddress4.rightAlign());
|
||||
pnlAddress4.appendChild(lblAddress4);
|
||||
pnlAddress4.appendChild(txtAddress4);
|
||||
ZKUpdateUtil.setHflex(txtAddress4, "1");
|
||||
|
||||
Row pnlAddress5 = new Row();
|
||||
pnlAddress5.appendChild(lblAddress5.rightAlign());
|
||||
pnlAddress5.appendChild(lblAddress5);
|
||||
pnlAddress5.appendChild(txtAddress5);
|
||||
ZKUpdateUtil.setHflex(txtAddress5, "1");
|
||||
|
||||
Row pnlComments = new Row();
|
||||
pnlComments.appendChild(lblComments.rightAlign());
|
||||
pnlComments.appendChild(lblComments);
|
||||
pnlComments.appendChild(txtComments);
|
||||
ZKUpdateUtil.setHflex(txtComments, "1");
|
||||
|
||||
Row pnlCity = new Row();
|
||||
pnlCity.appendChild(lblCity.rightAlign());
|
||||
pnlCity.appendChild(lblCity);
|
||||
pnlCity.appendChild(txtCity);
|
||||
ZKUpdateUtil.setHflex(txtCity, "1");
|
||||
|
||||
Row pnlPostal = new Row();
|
||||
pnlPostal.appendChild(lblPostal.rightAlign());
|
||||
pnlPostal.appendChild(lblPostal);
|
||||
pnlPostal.appendChild(txtPostal);
|
||||
ZKUpdateUtil.setHflex(pnlPostal, "1");
|
||||
|
||||
Row pnlPostalAdd = new Row();
|
||||
pnlPostalAdd.appendChild(lblPostalAdd.rightAlign());
|
||||
pnlPostalAdd.appendChild(lblPostalAdd);
|
||||
pnlPostalAdd.appendChild(txtPostalAdd);
|
||||
ZKUpdateUtil.setHflex(txtPostalAdd, "1");
|
||||
|
||||
Row pnlRegion = new Row();
|
||||
pnlRegion.appendChild(lblRegion.rightAlign());
|
||||
pnlRegion.appendChild(lblRegion);
|
||||
pnlRegion.appendChild(lstRegion);
|
||||
ZKUpdateUtil.setHflex(lstRegion, "1");
|
||||
|
||||
Row pnlCountry = new Row();
|
||||
pnlCountry.appendChild(lblCountry.rightAlign());
|
||||
pnlCountry.appendChild(lblCountry);
|
||||
pnlCountry.appendChild(lstCountry);
|
||||
ZKUpdateUtil.setHflex(lstCountry, "1");
|
||||
|
||||
|
|
|
@ -190,6 +190,12 @@ span.grid-combobox-editor {
|
|||
cursor: default;
|
||||
border: none;
|
||||
}
|
||||
.image-fit-contain {
|
||||
object-fit: contain;
|
||||
}
|
||||
.z-cell.image-field-cell {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.html-field {
|
||||
cursor: pointer;
|
||||
|
|
|
@ -224,6 +224,10 @@
|
|||
}
|
||||
.quick-entry-dialog > .z-window-content {
|
||||
overflow: auto;
|
||||
padding: 4px;
|
||||
}
|
||||
.quick-entry-dialog > .z-window-content > .confirm-panel {
|
||||
padding-top: 4px;
|
||||
}
|
||||
@media screen and (max-width: 350px) {
|
||||
.quick-entry-dialog {
|
||||
|
@ -300,9 +304,17 @@
|
|||
}
|
||||
|
||||
.location-dialog {
|
||||
width: 380px;
|
||||
height: 420px;
|
||||
}
|
||||
.location-dialog > .z-window-content > .z-borderlayout {
|
||||
min-width: 380px;
|
||||
}
|
||||
.location-dialog .field-label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.location-dialog .confirm-panel {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
@media screen and (max-width: 380px) {
|
||||
.location-dialog {
|
||||
width: 100%;
|
||||
|
|
Loading…
Reference in New Issue