File tree Expand file tree Collapse file tree 2 files changed +30
-3
lines changed
Expand file tree Collapse file tree 2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { usePurchaseOrderFields } from '../../forms/PurchaseOrderForms';
1212import { useCreateApiFormModal } from '../../hooks/UseForm' ;
1313import { useTable } from '../../hooks/UseTable' ;
1414import { useUserState } from '../../states/UserState' ;
15+ import { Text } from '@mantine/core' ;
1516import {
1617 CompanyColumn ,
1718 CompletionDateColumn ,
@@ -161,20 +162,32 @@ export function PurchaseOrderTable({
161162 modelType : ModelType . purchaseorder
162163 } ) ;
163164
165+ const totalBillsValue = useMemo ( ( ) => {
166+ let total = 0 ;
167+
168+ for ( const record of table . records ) {
169+ total += record . total_price ?? 0 ;
170+ }
171+
172+ return total
173+ } , [ table . records ] ) ;
174+
164175 const tableActions = useMemo ( ( ) => {
165176 return [
166177 < AddItemButton
167178 key = 'add-purchase-order'
168179 tooltip = { t `Add Purchase Order` }
169180 onClick = { ( ) => newPurchaseOrder . open ( ) }
170181 hidden = { ! user . hasAddRole ( UserRoles . purchase_order ) }
171- />
182+ /> ,
183+
172184 ] ;
173185 } , [ user ] ) ;
174186
175187 return (
176188 < >
177189 { newPurchaseOrder . modal }
190+
178191 < InvenTreeTable
179192 url = { apiUrl ( ApiEndpoints . purchase_order_list ) }
180193 tableState = { table }
@@ -195,6 +208,7 @@ export function PurchaseOrderTable({
195208 enableLabels : true
196209 } }
197210 />
211+ < Text fw = { 700 } c = "#4563dc" > Total Bills Value: { totalBillsValue } €</ Text >
198212 </ >
199213 ) ;
200214}
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions';
2121import { useTable } from '../../hooks/UseTable' ;
2222import { useGlobalSettingsState } from '../../states/SettingsStates' ;
2323import { useUserState } from '../../states/UserState' ;
24+ import { Text } from '@mantine/core' ;
2425import {
2526 DateColumn ,
2627 DescriptionColumn ,
@@ -427,6 +428,17 @@ export function StockItemTable({
427428
428429 return total ;
429430 } , [ table . records ] ) ;
431+
432+
433+ const totalStock = useMemo ( ( ) => {
434+ let total = 0 ;
435+
436+ for ( const record of table . records ) {
437+ total += record . quantity ?? 0 ;
438+ }
439+
440+ return total
441+ } , [ table . records ] ) ;
430442
431443
432444 const tableActions = useMemo ( ( ) => {
@@ -450,8 +462,7 @@ export function StockItemTable({
450462 hidden = { ! allowAdd || ! user . hasAddRole ( UserRoles . stock ) }
451463 tooltip = { t `Add Stock Item` }
452464 onClick = { ( ) => newStockItem . open ( ) }
453- /> ,
454- < p > < b > Total Stock Value: { totalStockValue } €</ b > </ p > ,
465+ />
455466 ] ;
456467 } , [
457468 user ,
@@ -486,6 +497,8 @@ export function StockItemTable({
486497 }
487498 } }
488499 />
500+ < Text fw = { 700 } c = "#4563dc" > Total Stock Value: { totalStockValue } €</ Text >
501+ < Text fw = { 700 } c = "#4563dc" > Total Stock: { totalStock } </ Text >
489502 </ >
490503 ) ;
491504}
You can’t perform that action at this time.
0 commit comments