Skip to content

Commit

Permalink
Merge pull request #138 from kimthu09/mai
Browse files Browse the repository at this point in the history
  • Loading branch information
bvquoc authored Jan 6, 2024
2 parents c27ab9b + f4581d5 commit f407f9d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion backend/module/invoice/invoicestore/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func handleFilter(
if filter.CreatedBy != nil {
db = db.
Joins("JOIN MUser AS CreatedByUser ON Invoice.createdBy = CreatedByUser.id").
Where("CreatedByUser.id = ?", *filter.CreatedBy)
Where("CreatedByUser.name LIKE ?", "%"+*filter.CreatedBy+"%")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"book-store-management-backend/module/supplierdebtreportdetail/supplierdebtreportdetailmodel"
"context"
"errors"
"fmt"
"time"
)

Expand Down Expand Up @@ -139,6 +140,7 @@ func (biz *findSupplierDebtReportBiz) FindSupplierDebtReport(
payAmount += supplierDebt.Quantity
}
}
fmt.Println(debtAmount)

initial := 0
if nearly, err := biz.supplierDebtStore.GetNearlySupplierDebt(
Expand All @@ -162,7 +164,7 @@ func (biz *findSupplierDebtReportBiz) FindSupplierDebtReport(
initial = final - debtAmount - payAmount
}

if initial != 0 && (debtAmount != 0 || payAmount != 0) {
if initial != 0 || debtAmount != 0 || payAmount != 0 {
detailCreate := supplierdebtreportdetailmodel.ReqCreateSupplierDebtReportDetail{
ReportId: reportId,
SupplierId: supplier.Id,
Expand Down
29 changes: 28 additions & 1 deletion frontend/components/report/DebtReportTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,33 @@ export const columns: ColumnDef<DebtReportDetail>[] = [
return <div className="text-right font-medium">{formatted}</div>;
},
},
{
accessorKey: "debt",
header: ({ column }) => (
<div className="flex justify-end">
<Button
variant={"ghost"}
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-1"
>
<span className="font-semibold">Nợ</span>

<CaretSortIcon className="h-4 w-4" />
</Button>
</div>
),
cell: ({ row }) => {
const amount = parseFloat(row.getValue("debt"));

// Format the amount as a dollar amount
const formatted = new Intl.NumberFormat("vi-VN", {
style: "currency",
currency: "VND",
}).format(amount);

return <div className="text-right font-medium">{formatted}</div>;
},
},
{
accessorKey: "pay",
header: ({ column }) => (
Expand All @@ -80,7 +107,7 @@ export const columns: ColumnDef<DebtReportDetail>[] = [
onClick={() => column.toggleSorting(column.getIsSorted() === "asc")}
className="p-1"
>
<span className="font-semibold">Chênh lệch</span>
<span className="font-semibold">Trả nợ</span>

<CaretSortIcon className="h-4 w-4" />
</Button>
Expand Down
5 changes: 0 additions & 5 deletions frontend/components/report/MonthReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ const MonthReportHeader = (props: any) => {
timeTo: from.endOf('month').valueOf() / 1000
})}
className='px-5'>{firstAction}</Button>
<Button
type="button"
className='pl-[20px] pr-[20px] bg-white border border-primary text-primary hover:text-primary' variant={"outline"}
>{secondAction}
</Button>
</div>
</div>
);
Expand Down
5 changes: 0 additions & 5 deletions frontend/components/report/ReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ const ReportHeader = (props: any) => {
timeTo: (date?.to?.getTime() ?? 0) / 1000
})}
className='px-5'>{firstAction}</Button>
<Button
type="button"
className='pl-[20px] pr-[20px] bg-white border border-primary text-primary hover:text-primary' variant={"outline"}
>{secondAction}
</Button>
</div>
</div>
);
Expand Down

0 comments on commit f407f9d

Please sign in to comment.