diff --git a/backend/api/restock.go b/backend/api/restock.go index d6146dd..6180de8 100644 --- a/backend/api/restock.go +++ b/backend/api/restock.go @@ -85,6 +85,7 @@ func (s *Server) CreateRestock(c echo.Context) error { AmountOfBundle: item.AmountOfBundle, AmountPerBundle: item.AmountPerBundle, BundleCostHt: item.BundleCostHt, + BundleCostTtc: item.BundleCostTtc, ItemId: item.ItemId, Tva: item.Tva, } @@ -104,31 +105,31 @@ func (s *Server) CreateRestock(c echo.Context) error { item.State = autogen.ItemBuyable item.AmountLeft += restockItem.AmountOfBundle * restockItem.AmountPerBundle item.LastTva = &restockItem.Tva - item.Prices.Coutant = uint64(math.Ceil((10000.0 + float64(restockItem.Tva)) * float64(restockItem.BundleCostHt) / (10000.0 * float64(restockItem.AmountPerBundle)))) + item.Prices.Coutant = uint64(math.Ceil(float64(restockItem.BundleCostTtc) / (float64(restockItem.AmountPerBundle)))) if item.Prices.Coutant < 30 { item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant, 5) + 20 item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant, 5) + 10 item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant, 5) + 5 item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant, 5) + 5 - item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant, 5) + 10 + item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant, 5) + 10 } else if item.Prices.Coutant >= 30 && item.Prices.Coutant < 130 { item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant*3/2, 5) - item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*113/100, 5) - item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*108/100, 5) + item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*113/100, 5) + item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*108/100, 5) item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) - item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant*13/10, 5) + item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant*13/10, 5) } else if item.Prices.Coutant >= 130 && item.Prices.Coutant < 300 { item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant*14/10, 5) - item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) - item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*108/100, 5) + item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) + item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*108/100, 5) item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) - item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant*12/10, 5) + item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant*12/10, 5) } else if item.Prices.Coutant >= 300 { item.Prices.Externe = arrondiAuMutilple(item.Prices.Coutant*125/100, 5) - item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) - item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*105/100, 5) + item.Prices.Ceten = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) + item.Prices.StaffBar = arrondiAuMutilple(item.Prices.Coutant*105/100, 5) item.Prices.Privilegies = arrondiAuMutilple(item.Prices.Coutant*11/10, 5) - item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant*1125/1000, 5) + item.Prices.Menu = arrondiAuMutilple(item.Prices.Coutant*1125/1000, 5) } err = s.DBackend.UpdateItem(c.Request().Context(), item) if err != nil { diff --git a/backend/autogen/bar.gen.go b/backend/autogen/bar.gen.go index ef970f2..16ecedb 100644 --- a/backend/autogen/bar.gen.go +++ b/backend/autogen/bar.gen.go @@ -399,6 +399,7 @@ type NewRestockItem struct { AmountOfBundle uint64 `json:"amount_of_bundle" bson:"amount_of_bundle"` AmountPerBundle uint64 `json:"amount_per_bundle" bson:"amount_per_bundle"` BundleCostHt uint64 `json:"bundle_cost_ht" bson:"bundle_cost_ht"` + BundleCostTtc uint64 `json:"bundle_cost_ttc" bson:"bundle_cost_ttc"` ItemId UUID `json:"item_id" bson:"item_id"` Tva uint64 `json:"tva" bson:"tva"` } @@ -465,6 +466,7 @@ type RestockItem struct { AmountOfBundle uint64 `json:"amount_of_bundle" bson:"amount_of_bundle"` AmountPerBundle uint64 `json:"amount_per_bundle" bson:"amount_per_bundle"` BundleCostHt uint64 `json:"bundle_cost_ht" bson:"bundle_cost_ht"` + BundleCostTtc uint64 `json:"bundle_cost_ttc" bson:"bundle_cost_ttc"` ItemId UUID `json:"item_id" bson:"item_id"` // ItemName Name of the current item @@ -10069,98 +10071,98 @@ var swaggerSpec = []string{ "9pJOKvYt763Gvv0EHzrFUfTeCkZ+O3gzGPzvf/+PwcyLBVUsHarQHD+w5AF910P0ktxyPuZW59kZym3i", "7BN8WKHf2tWZWnad1kJWp1qs1M9oTG4EKNRntyLvobm76E7DmrkfvJ+l0U3gzf7OZn8VjqtGJcyFI5Y1", "/nfZyF+FfZ/b9jVMfg0pw+Gd5cSHxPeQdHAxdqPZYug6ymWYgWQYYsqGU2eMa40YC51biS/NACtob3nV", - "ihqvzlxMkCvQqIGaV6JR6uLxcDRHUQKd5aZsl0LSsaGs3RX94pCmw3G/q5fVgu+hZjtpeLFNuTIbOXLN", - "OmgqpcXPpYXKlkUZKsxzEtmEVWcO0UCxc0kNHeZQtk+xzdBfw6qncXgHI23vHG4EMTrBWBEj7QsLMtTx", - "p/sM8wPT1s23iBerUItlv+29HXwvrZTvO1kpKIRJt8iMosl2QzO6nOnQeSdgVIMOsGQN6lHitOFLOssD", - "jd02H97EvvfoQYXGD6UI5GpC4ePPMKUjoTK/ht1Kn4HmhMr8BBn1VD0fedtbNek8xBjQqRJc6hx/LMI1", - "wykM77jOw6aQOHpS5Ahnssfsh+hXjc2Fh+xelapB5K/PcigBao1udFDBUV31QNWgXfbJitaNck1K5wFq", - "nHGuiSwbHHaA+qmMOVraghbdrONQYnn9uZihBczVq9c6SWv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NA2hEE1akRUMwh+bW8Hmmxlsxw0SMXx", - "qDQyNms8tMAoQIo8e7zUFwsNGizbE0vwaVUF6T8Zvzso900MnSn2BkM7Kvblni0afhnkjaj6ck7R4RL/", - "+20Qv6b2L033DE4wiWF7MjutqlXt1kobifpmih+CqUCh1mfwSkAeYJQ8vq5RUmUjm5JaZJH8uhnXpgD7", - "cY/cmq1JVbXldXz9I8ywYIuROisK16azZItgYxdZth0nZz1c3sH5MjUTRW377eTU+N/cGrg6JGfYQROq", - "kQ26hzOv4qwE5S2s+k8O4wZfoni/YRLbW4+fsbs0nprXUE6hZOwHyQw2uKN4Kuyo3TS/k9ug2vCGu06G", - "63ord7Ua18BrXP7wy2+HzcpWP7dHG21zUUs86eu0f16ITndPem0/17xE5N4mmdcza632vC6nQycHCYdj", - "f47n4pwdlj2V8+KvRQ+TqHZ0MKnEb1Xn0oUsOBDl6xN8kPxUE1q1BR9XHTxe2/IBfDuobmVSp13TMlOi", - "trm5kF1EFT6uHRVU20w56l953f7tmz1OSakpEM0+nBreFA4cz5abdRytRn0ZePXFi7sDFXddNJd+Gods", - "TmCz10jKxyCra/EWcbxd5cVeWHa/HZmiyZ7dj9x9VlmUSZyYIiffJr7IvC+7yxsvlj5fyAEkJ1RpW0b5", - "ux2NhKkqB3llC1mqUMzTospuXX3JYD/gSy/6Wjv50bVMWvvhSgc69S3rTffPsu6oVqrEUY0kM14ganKj", - "XUEyAxzu5FFJOMr10iwL46ubL1fn16cfLy8+va4JpnfMZL0D7+37a7LbffdrOw/hZ6Pvs/O8YPZan9s1", - "pAwTGICyolJhW1XT1FVeAPt6n5EXG15stOsIXRKFZrLEIWGokieVvKEHZAFtM9ynJXnqy4/78ZbKPksh", - "x1SYVnOlJJ1cjJYFs/5V0gn6TJkHEelskNd29JESEAdnzbRk8jSNmhfJ3t6+8WLFi5WF9Yz2DK4VUVOb", - "ybUkZrKErt7U2aipY89q6y0db+nssARyy1XaYueI5MEdzJxuGUzL+VF9KtMDUkZYJafp5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qv5iwll4xYYcpAwvKdRSCooFDeKtG0ctq4Afi", + "HYKI8d69BHaTwIrAxIGV1Zl8RqB4RjqTYhXJKytc56XreD35E3zIecYWziSKAoaDUADj8Iby6qiyATCJ", + "msjz3wt10GaEt5NnTBYe19Ws/pP6qy0gRZ49NwiALEA+K3UOtM0aWCNtM9g2ch6tztcPl2Heb5Zhdu3V", + "2hpecQ4nBUkS8Hr30HSJvMIkgoS+tpkrOx1TunnHzjoOMDQUO5xjZM9t7s7Rgg+X9eGyL83kMFa6KmYd", + "shMV58QxapC6Wf6iVuHrdHZciAmRnGSbMqIr89mPHD3j7DnjiJa8K0muc5L0TnpTxtKTfj/BIUimmLKT", + "Hwc/Dnp81yvKKa8Aj0eAvGEwgSGeIYDCxzcIsj5I4/79W0sDXvsRPuBk/GZMeLWeBls1xjUBIrIVB3MK", + "yXdUV3RlEEf2VC2faHVTtnRQRKeZr9xSp+al/aUa+erWjfJYB68IBEkwwwg+vi5fD7T1VORzLsJCYiTM", + "IDrFaSVYIoa2XoSgCjAKKEhgTQdSONgg0J/TEUE1+Sui+diyihUTMmgZExW1zHXC7JpC0UMWr/j89fn/", + "AgAA//9mKbT9zZkBAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/bar.openapi.yml b/bar.openapi.yml index 29e6ac1..57ada86 100644 --- a/bar.openapi.yml +++ b/bar.openapi.yml @@ -5346,6 +5346,9 @@ components: bundle_cost_ht: type: integer format: uint64 + bundle_cost_ttc: + type: integer + format: uint64 tva: type: integer format: uint64 @@ -5354,6 +5357,7 @@ components: - amount_of_bundle - amount_per_bundle - bundle_cost_ht + - bundle_cost_ttc - tva NewRestock: type: object @@ -5397,6 +5401,9 @@ components: bundle_cost_ht: type: integer format: uint64 + bundle_cost_ttc: + type: integer + format: uint64 tva: type: integer format: uint64 @@ -5407,6 +5414,7 @@ components: - amount_of_bundle - amount_per_bundle - bundle_cost_ht + - bundle_cost_ttc - tva RestockType: type: string diff --git a/frontend/Taskfile.yml b/frontend/Taskfile.yml index 64f9916..d24b3b6 100644 --- a/frontend/Taskfile.yml +++ b/frontend/Taskfile.yml @@ -6,7 +6,7 @@ tasks: setup: cmds: - npm install - - npm install @openapitools/openapi-generator-cli + - npm install @openapitools/openapi-generator-cli -g regen: cmds: - openapi-generator-cli generate -i ../bar.openapi.yml -g typescript-axios -o ./src/lib/api diff --git a/frontend/src/lib/api/api.ts b/frontend/src/lib/api/api.ts index f1e33af..7ba6a3a 100644 --- a/frontend/src/lib/api/api.ts +++ b/frontend/src/lib/api/api.ts @@ -1441,6 +1441,12 @@ export interface NewRestockItem { * @memberof NewRestockItem */ 'bundle_cost_ht': number; + /** + * + * @type {number} + * @memberof NewRestockItem + */ + 'bundle_cost_ttc': number; /** * * @type {number} @@ -1790,6 +1796,12 @@ export interface RestockItem { * @memberof RestockItem */ 'bundle_cost_ht': number; + /** + * + * @type {number} + * @memberof RestockItem + */ + 'bundle_cost_ttc': number; /** * * @type {number} diff --git a/frontend/src/routes/panel/products/reappro/+page.svelte b/frontend/src/routes/panel/products/reappro/+page.svelte index 3e1b9c9..697f222 100644 --- a/frontend/src/routes/panel/products/reappro/+page.svelte +++ b/frontend/src/routes/panel/products/reappro/+page.svelte @@ -26,6 +26,7 @@ amount_of_bundle: 0, amount_per_bundle: 0, bundle_cost_ht: 0, + bundle_cost_ttc: 0, tva: 0 }; let searchName: string = ''; @@ -85,9 +86,7 @@ }); newRestock.total_cost_ttc = 0.0; newRestock.items.forEach((item) => { - newRestock.total_cost_ttc += Math.floor( - item.amount_of_bundle * item.bundle_cost_ht * (1 + item.tva / 10000) - ); + Math.floor((newRestock.total_cost_ttc += item.amount_of_bundle * item.bundle_cost_ttc)); }); } @@ -97,30 +96,58 @@ restocksApi() .createRestock(newRestock, { withCredentials: true }) .then((res) => { - restoks = [...restoks, res.data]; + restoks = [res.data, ...restoks]; + newRestock = { + total_cost_ht: 0, + total_cost_ttc: 0, + driver_id: '', + type: newRestock.type, + items: [] + }; + displayedValues = { + name: 'Nom du produit', + item_price_calc: 0, + item_price: 'Prix coûtant TTC', + item_price_ht: 'Prix coûtant HT', + amount_of_bundle: 'Nombre de lots', + amount_per_bundle: 'Nombre de produits par lots', + bundle_cost_ht: "Prix d'un lot HT", + tva: 0, + bundle_cost_ttc: "Prix d'un lot TTC" + }; + newItem = { + item_id: '', + amount_of_bundle: 0, + amount_per_bundle: 0, + bundle_cost_ht: 0, + bundle_cost_ttc: 0, + tva: 0 + }; + // @ts-ignore + document.getElementById('CHECKBOX').checked = false; }); - await wait(1000); - location.reload(); - } - - function wait(ms: number): Promise { - return new Promise(resolve => setTimeout(resolve, ms)); } function updatePrices() { // Calculate from displayedValues.item_price_calc, displayedValues.amount_of_bundle and TVA - newItem.bundle_cost_ht = Math.ceil( - (displayedValues.item_price_calc * newItem.amount_per_bundle) / (1 + newItem.tva / 10000) - ); + if (newItem.amount_of_bundle === 0 || newItem.amount_per_bundle === 0) return; displayedValues.item_price_ht = formatPrice( displayedValues.item_price_calc / (1 + (newItem.tva ?? 0) / 10000) ); + if (displayedValues.bundle_cost_ht === "Prix d'un lot HT") { + newItem.bundle_cost_ht = Math.ceil( + (displayedValues.item_price_calc * newItem.amount_per_bundle) / (1 + newItem.tva / 10000) + ); + } displayedValues.bundle_cost_ht = formatPrice(newItem.bundle_cost_ht); - displayedValues.bundle_cost_ttc = formatPrice( - displayedValues.item_price_calc * newItem.amount_per_bundle - ); + if (displayedValues.bundle_cost_ttc === "Prix d'un lot TTC") { + newItem.bundle_cost_ttc = Math.ceil( + displayedValues.item_price_calc * newItem.amount_per_bundle + ); + } + displayedValues.bundle_cost_ttc = formatPrice(newItem.bundle_cost_ttc); } @@ -329,6 +356,9 @@ displayedValues.bundle_cost_ht = r; // @ts-ignore e.target.value = r; + newItem.bundle_cost_ttc = Math.ceil( + newItem.bundle_cost_ht * (1 + newItem.tva / 10000) + ); displayedValues.bundle_cost_ttc = formatPrice( Number((newItem.bundle_cost_ht * (1 + newItem.tva / 10000)).toFixed(0)) ); @@ -363,14 +393,16 @@ class="rounded-lg border-transparent flex-1 appearance-none border border-gray-300 w-full py-2 px-4 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent" placeholder={displayedValues.bundle_cost_ttc} on:change={(e) => { - // @ts-ignore - newItem.bundle_cost_ht = parsePrice(e.target?.value) / (1 + (newItem.tva ?? 0) / 10000); - let r = formatPrice(newItem.bundle_cost_ht); - displayedValues.bundle_cost_ht = r; - displayedValues.bundle_cost_ttc = formatPrice( - Number((newItem.bundle_cost_ht * (1 + newItem.tva / 10000)).toFixed(0)) + newItem.bundle_cost_ht = Math.ceil( + // @ts-ignore + parsePrice(e.target?.value) / (1 + (newItem.tva ?? 0) / 10000) ); // @ts-ignore + newItem.bundle_cost_ttc = parsePrice(e.target?.value); + let r = formatPrice(newItem.bundle_cost_ttc); + displayedValues.bundle_cost_ttc = r; + displayedValues.bundle_cost_ht = formatPrice(newItem.bundle_cost_ht); + // @ts-ignore e.target.value = r; }} /> @@ -403,6 +435,7 @@ amount_of_bundle: 0, amount_per_bundle: 0, bundle_cost_ht: 0, + bundle_cost_ttc: 0, tva: 0 }; updateTotalHTandTTC(); @@ -439,9 +472,7 @@ class="rounded-lg border-transparent flex-1 appearance-none border border-gray-300 w-full py-2 px-4 bg-gray-300 text-gray-700 placeholder-gray-400 shadow-sm text-base focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent" >

- {formatPrice( - item.bundle_cost_ht * item.amount_of_bundle * (1 + item.tva / 10000) - )} + {formatPrice(item.bundle_cost_ttc * item.amount_of_bundle)}

@@ -487,7 +518,7 @@
-

{formatPrice(item.bundle_cost_ht * (1 + item.tva / 10000))}

+

{formatPrice(item.bundle_cost_ttc)}

@@ -513,7 +544,12 @@

Ma réappro est irréprochable, et j'en suis responsable :

- + {#if sure}