Speichern und Laden von Einheits-Preisen implementiert
This commit is contained in:
@@ -224,7 +224,6 @@ public class DocumentApi extends BaseHandler {
|
|||||||
} catch (UmbrellaException e) {
|
} catch (UmbrellaException e) {
|
||||||
LOG.log(WARNING,e);
|
LOG.log(WARNING,e);
|
||||||
}
|
}
|
||||||
LOG.log(WARNING,"Updating settings of company-customer-document combination not implemented!");
|
|
||||||
var attachment = new Attachment(doc.number()+".pdf",rendered.mimeType(),rendered.bytes());
|
var attachment = new Attachment(doc.number()+".pdf",rendered.mimeType(),rendered.bytes());
|
||||||
var message = new Message(user,subject,content,null,List.of(attachment));
|
var message = new Message(user,subject,content,null,List.of(attachment));
|
||||||
var envelope = new Envelope(message,new User(doc.customer().shortName(),new EmailAddress(email),doc.customer().language()));
|
var envelope = new Envelope(message,new User(doc.customer().shortName(),new EmailAddress(email),doc.customer().language()));
|
||||||
@@ -504,7 +503,10 @@ public class DocumentApi extends BaseHandler {
|
|||||||
if (!(json.has(FIELD_ITEM_CODE) && json.get(FIELD_ITEM_CODE) instanceof String itemCode)) throw missingFieldException(FIELD_ITEM_CODE);
|
if (!(json.has(FIELD_ITEM_CODE) && json.get(FIELD_ITEM_CODE) instanceof String itemCode)) throw missingFieldException(FIELD_ITEM_CODE);
|
||||||
if (!(json.has(TITLE) && json.get(TITLE) instanceof String title)) throw missingFieldException(TITLE);
|
if (!(json.has(TITLE) && json.get(TITLE) instanceof String title)) throw missingFieldException(TITLE);
|
||||||
if (!(json.has(FIELD_UNIT) && json.get(FIELD_UNIT) instanceof String unit)) throw missingFieldException(FIELD_UNIT);
|
if (!(json.has(FIELD_UNIT) && json.get(FIELD_UNIT) instanceof String unit)) throw missingFieldException(FIELD_UNIT);
|
||||||
var unitPrice =json.has(FIELD_UNIT_PRICE) && json.get(FIELD_UNIT_PRICE) instanceof Number num ? num : 0L;
|
var unitPrice = json.has(FIELD_UNIT_PRICE) && json.get(FIELD_UNIT_PRICE) instanceof Number num ? num : 0L;
|
||||||
|
try {
|
||||||
|
unitPrice = db.getCustomerPrice(doc.companyId(),doc.customer().id(),itemCode);
|
||||||
|
} catch (UmbrellaException ignored) {}
|
||||||
int tax = json.has(FIELD_TAX) && json.get(FIELD_TAX) instanceof Number t ? t.intValue() : 19; // TODO should not be hard-coded
|
int tax = json.has(FIELD_TAX) && json.get(FIELD_TAX) instanceof Number t ? t.intValue() : 19; // TODO should not be hard-coded
|
||||||
Long timeId = json.has(FIELD_TIME_ID) && json.get(FIELD_TIME_ID) instanceof Number t ? t.longValue() : null;
|
Long timeId = json.has(FIELD_TIME_ID) && json.get(FIELD_TIME_ID) instanceof Number t ? t.longValue() : null;
|
||||||
var pos = new Position(doc.positions().size()+1,itemCode,amount.doubleValue(),unit,title,description,unitPrice.longValue(),tax,timeId,false);
|
var pos = new Position(doc.positions().size()+1,itemCode,amount.doubleValue(),unit,title,description,unitPrice.longValue(),tax,timeId,false);
|
||||||
|
|||||||
@@ -122,9 +122,7 @@ public final class Position implements Mappable {
|
|||||||
case FIELD_TAX: tax = json.getInt(key); break;
|
case FIELD_TAX: tax = json.getInt(key); break;
|
||||||
case TITLE: title = json.getString(key); break;
|
case TITLE: title = json.getString(key); break;
|
||||||
case FIELD_UNIT: unit = json.getString(key); break;
|
case FIELD_UNIT: unit = json.getString(key); break;
|
||||||
case FIELD_UNIT_PRICE: unitPrice = json.getLong(key);
|
case FIELD_UNIT_PRICE: unitPrice = json.getLong(key); break;
|
||||||
LOG.log(WARNING,"Updating unit price for customer in company settings not implemented!");
|
|
||||||
break;
|
|
||||||
default: key = null;
|
default: key = null;
|
||||||
}
|
}
|
||||||
if (key != null) dirtyFields.add(key);
|
if (key != null) dirtyFields.add(key);
|
||||||
|
|||||||
@@ -68,10 +68,10 @@
|
|||||||
<td colspan="2"></td>
|
<td colspan="2"></td>
|
||||||
<td>{t('net_sum')}</td>
|
<td>{t('net_sum')}</td>
|
||||||
<td>{document.net_sum/100} {document.currency}</td>
|
<td>{document.net_sum/100} {document.currency}</td>
|
||||||
<td colspan="2">{t('gros_sum')}</td>
|
<td colspan="2">{t('gross_sum')}</td>
|
||||||
<td>{document.gross_sum/100} {document.currency}</td>
|
<td>{document.gross_sum/100} {document.currency}</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -216,7 +216,7 @@
|
|||||||
<button onclick={() => position_select = true}>{t('add_position')}</button>
|
<button onclick={() => position_select = true}>{t('add_position')}</button>
|
||||||
{/if}
|
{/if}
|
||||||
</legend>
|
</legend>
|
||||||
<PositionList bind:document={doc} {update} bind:error={error} />
|
<PositionList bind:document={doc} submit={update} bind:error={error} />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{t('footer')}</legend>
|
<legend>{t('footer')}</legend>
|
||||||
@@ -230,8 +230,6 @@
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>TODO</legend>
|
<legend>TODO</legend>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Button zum Versenden des Dokuments einbauen</li>
|
|
||||||
<li>Preise in den Company-Einstellungen ändern, wenn für eine Position der Preis geändert wird – siehe <em>documents.db</em>, Tabelle <em>customer_prices</em></li>
|
|
||||||
<li>Preise in der Tabelle neu berechnen, wenn Positionen geändert werden</li>
|
<li>Preise in der Tabelle neu berechnen, wenn Positionen geändert werden</li>
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
Reference in New Issue
Block a user