Overview
Comment: | Invoice module implementation of quotation's items recording |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | invoice_module |
Files: | files | file ages | folders |
SHA3-256: |
52d16714fceb792244a8771c3a865d2a |
User & Date: | alinaar on 2023-02-03 17:09:01 |
Other Links: | branch diff | manifest | tags |
Context
2023-02-03
| ||
17:10 | Merge dev branch check-in: 06a9f2d2f6 user: alinaar tags: invoice_module | |
17:09 | Invoice module implementation of quotation's items recording check-in: 52d16714fc user: alinaar tags: invoice_module | |
12:14 | Invoice module implementation of quotation's status and total check-in: c37b52c4a1 user: alinaar tags: invoice_module | |
Changes
Modified src/skel-dist/modules/invoice/index.html from [c09ccfbab4] to [2451077ff4].
︙ | ︙ | |||
94 95 96 97 98 99 100 | {{* ==================== Creation form ==================== *}} <h1>Création d'un devis</h1> {{if $_POST.quotation_submit}} {{:assign computed_total=0}} | > > | > > > > > > > > > > > > | | > | > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | {{* ==================== Creation form ==================== *}} <h1>Création d'un devis</h1> {{if $_POST.quotation_submit}} {{:assign computed_total=0}} {{:assign errors=null}} {{:assign items=null}} {{#foreach from=$_POST.items key='index' item='item'}} {{:assign var='computed_total' value="%d + %d * %d"|args:$computed_total:$item.unit_price:$item.quantity|math}} {{* ToDo: allow zero as unit_price (#d10fbfa243f3cdb8cdf68ac67f5043c199bd44e2) *}} {{if $item.unit_price < 0 || $item.unit_price != $item.unit_price|floatval|strtolower}} {{* Hack to check the data is a number *}} {{:assign var='errors[]' value='Le prix saisi pour "%s" est invalide.'|args:$item.name}} {{/if}} {{if $item.quantity < 0 || $item.quantity != $item.quantity|floatval|strtolower}}{{:assign var='errors[]' value='La quantité saisie pour "%s" est invalide.'|args:$item.name}}{{/if}} {{:assign var='computed_item' value=$item}} {{:assign var='computed_item[unit_price]' value=$item.unit_price|floatval}} {{:assign var='computed_item[quantity]' value=$item.quantity|floatval}} {{:assign var='items[]' value=$computed_item}} {{/foreach}} {{if $computed_total != $_POST.quotation_total || $computed_total < 0}} {{:assign error="Erreur de calcul du total.\nEnregistrement du devis refusé."}} {{/if}} {{if $errors|count}} {{#foreach from=$errors item='error'}} <p class="error block">{{$error}}</p> {{/foreach}} {{else}} {{:assign new_key="%d+1"|math:$module.config.last_id}} {{:assign id="%d+1"|math:$module.config.last_quotation_id}} {{:save key=$id validate_schema="./quotation.schema.json" id=$new_key type='quotation' recipient_business_name=$_POST.recipient_business_name recipient_address=$_POST.recipient_address subject=$_POST.subject date=$_POST.date deadline=$_POST.deadline status=$_POST.status items=$items total=$computed_total contact_info=$_POST.contact_info }} {{:save key="config" last_id=$new_key last_quotation_id=$id}} {{:http redirect="?ok=1"}} {{/if}} |
︙ | ︙ |
Modified src/skel-dist/modules/invoice/quotation.schema.json from [072f0dcefb] to [d9ca3f4380].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | "type": ["string", "null"] }, "status": { "description": "Statut", "type": "string", "enum": ["awaiting", "rejected", "validated", "misc"] }, "total": { "description": "Total", "type": ["float", "integer"] }, "contact_info": { "description": "Contact", "type": "string" } }, "required": [ "recipient_business_name", "recipient_address", "subject", "date", "status", "contact_info" ] } | > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | "type": ["string", "null"] }, "status": { "description": "Statut", "type": "string", "enum": ["awaiting", "rejected", "validated", "misc"] }, "items": { "description": "Articles", "type": ["array", "null"] }, "total": { "description": "Total", "type": ["float", "integer"] }, "contact_info": { "description": "Contact", "type": "string" } }, "required": [ "recipient_business_name", "recipient_address", "subject", "date", "status", "contact_info" ] } |