3737use App \Services \Formatters \AmountFormatter ;
3838use App \Services \Formatters \MoneyFormatter ;
3939use App \Services \ProjectSystem \ProjectBuildHelper ;
40+ use Brick \Math \BigDecimal ;
4041use Brick \Math \RoundingMode ;
4142use Doctrine \ORM \AbstractQuery ;
4243use Doctrine \ORM \Query ;
@@ -93,14 +94,14 @@ public function configure(DataTable $dataTable, array $options): void
9394 return htmlspecialchars ($ this ->amountFormatter ->format ($ context ->getQuantity (), $ context ->getPart ()->getPartUnit ()));
9495 },
9596 ])
96- ->add ('partId ' , TextColumn::class, [
97- 'label ' => $ this ->translator ->trans ('project.bom.part_id ' ),
98- 'visible ' => true ,
99- 'orderField ' => 'part.id ' ,
100- 'render ' => function ($ value , ProjectBOMEntry $ context ) {
101- return $ context ->getPart () instanceof Part ? (string ) $ context ->getPart ()->getId () : '' ;
102- },
103- ])
97+ ->add ('partId ' , TextColumn::class, [
98+ 'label ' => $ this ->translator ->trans ('project.bom.part_id ' ),
99+ 'visible ' => true ,
100+ 'orderField ' => 'part.id ' ,
101+ 'render ' => function ($ value , ProjectBOMEntry $ context ) {
102+ return $ context ->getPart () instanceof Part ? (string ) $ context ->getPart ()->getId () : '' ;
103+ },
104+ ])
104105 ->add ('name ' , TextColumn::class, [
105106 'label ' => $ this ->translator ->trans ('part.table.name ' ),
106107 'orderField ' => 'NATSORT(part.name) ' ,
@@ -161,7 +162,7 @@ public function configure(DataTable $dataTable, array $options): void
161162 'label ' => $ this ->translator ->trans ('part.table.manufacturingStatus ' ),
162163 'data ' => static fn (ProjectBOMEntry $ context ): ?ManufacturingStatus => $ context ->getPart ()?->getManufacturingStatus(),
163164 'orderField ' => 'part.manufacturing_status ' ,
164- 'class ' => ManufacturingStatus::class,
165+ 'class ' => ManufacturingStatus::class,
165166 'render ' => function (?ManufacturingStatus $ status , ProjectBOMEntry $ context ): string {
166167 if ($ status === null ) {
167168 return '' ;
@@ -212,7 +213,7 @@ public function configure(DataTable $dataTable, array $options): void
212213 'visible ' => false ,
213214 'render ' => function ($ value , ProjectBOMEntry $ context ) {
214215 $ price = $ this ->projectBuildHelper ->getEntryUnitPrice ($ context );
215- return $ this ->moneyFormatter ->format ($ price ->toScale (2 , RoundingMode::UP )->toFloat (), null , 2 , true );
216+ return $ this ->moneyFormatter ->format ($ price ->toScale (2 , RoundingMode::Up )->toFloat (), null , 2 , true );
216217 },
217218 ])
218219 ->add ('ext_price ' , TextColumn::class, [
@@ -221,7 +222,8 @@ public function configure(DataTable $dataTable, array $options): void
221222 'render ' => function ($ value , ProjectBOMEntry $ context ) {
222223 $ price = $ this ->projectBuildHelper ->getEntryUnitPrice ($ context );
223224 return $ this ->moneyFormatter ->format (
224- $ price ->multipliedBy ($ context ->getQuantity ())->toScale (2 , RoundingMode::UP )->toFloat (),
225+ $ price ->multipliedBy (BigDecimal::fromFloatShortest ($ context ->getQuantity ()))
226+ ->toScale (2 , RoundingMode::Up)->toFloat (),
225227 null ,
226228 2 ,
227229 true
0 commit comments