Speichern und Laden von Einheits-Preisen implementiert
This commit is contained in:
@@ -224,7 +224,6 @@ public class DocumentApi extends BaseHandler {
|
||||
} catch (UmbrellaException 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 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()));
|
||||
@@ -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(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);
|
||||
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
|
||||
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);
|
||||
|
||||
@@ -122,9 +122,7 @@ public final class Position implements Mappable {
|
||||
case FIELD_TAX: tax = json.getInt(key); break;
|
||||
case TITLE: title = json.getString(key); break;
|
||||
case FIELD_UNIT: unit = json.getString(key); break;
|
||||
case FIELD_UNIT_PRICE: unitPrice = json.getLong(key);
|
||||
LOG.log(WARNING,"Updating unit price for customer in company settings not implemented!");
|
||||
break;
|
||||
case FIELD_UNIT_PRICE: unitPrice = json.getLong(key); break;
|
||||
default: key = null;
|
||||
}
|
||||
if (key != null) dirtyFields.add(key);
|
||||
|
||||
@@ -68,10 +68,10 @@
|
||||
<td colspan="2"></td>
|
||||
<td>{t('net_sum')}</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></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
<button onclick={() => position_select = true}>{t('add_position')}</button>
|
||||
{/if}
|
||||
</legend>
|
||||
<PositionList bind:document={doc} {update} bind:error={error} />
|
||||
<PositionList bind:document={doc} submit={update} bind:error={error} />
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{t('footer')}</legend>
|
||||
@@ -230,8 +230,6 @@
|
||||
<fieldset>
|
||||
<legend>TODO</legend>
|
||||
<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>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user