Update Report

This commit is contained in:
Aditya Siregar 2025-09-25 20:31:33 +07:00
parent 116f6b8009
commit 4ba5b9def3
2 changed files with 9 additions and 42 deletions

View File

@ -369,12 +369,6 @@ const DailyPOSReport = () => {
<span className='text-gray-700'>Total Invoice</span> <span className='text-gray-700'>Total Invoice</span>
<span className='font-semibold text-gray-800'>{profitLoss?.summary.total_orders ?? 0}</span> <span className='font-semibold text-gray-800'>{profitLoss?.summary.total_orders ?? 0}</span>
</div> </div>
<div className='flex justify-between items-center py-2 border-b border-gray-200'>
<span className='text-gray-700'>Rata-rata Tagihan Per Invoice </span>
<span className='font-semibold text-gray-800'>
{formatCurrency(profitLoss?.summary.average_profit ?? 0)}
</span>
</div>
</div> </div>
</div> </div>
@ -446,7 +440,6 @@ const DailyPOSReport = () => {
<thead> <thead>
<tr className='text-gray-800 border-b-2 border-gray-300'> <tr className='text-gray-800 border-b-2 border-gray-300'>
<th className='text-left p-3 font-semibold'>Nama</th> <th className='text-left p-3 font-semibold'>Nama</th>
<th className='text-center p-3 font-semibold'>Total Produk</th>
<th className='text-center p-3 font-semibold'>Qty</th> <th className='text-center p-3 font-semibold'>Qty</th>
<th className='text-right p-3 font-semibold'>Pendapatan</th> <th className='text-right p-3 font-semibold'>Pendapatan</th>
</tr> </tr>
@ -455,7 +448,6 @@ const DailyPOSReport = () => {
{category?.data?.map((c, index) => ( {category?.data?.map((c, index) => (
<tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}> <tr key={index} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
<td className='p-3 font-medium text-gray-800'>{c.category_name}</td> <td className='p-3 font-medium text-gray-800'>{c.category_name}</td>
<td className='p-3 text-center text-gray-700'>{c.product_count}</td>
<td className='p-3 text-center text-gray-700'>{c.total_quantity}</td> <td className='p-3 text-center text-gray-700'>{c.total_quantity}</td>
<td className='p-3 text-right font-semibold' style={{ color: '#36175e' }}> <td className='p-3 text-right font-semibold' style={{ color: '#36175e' }}>
{formatCurrency(c.total_revenue)} {formatCurrency(c.total_revenue)}
@ -466,7 +458,6 @@ const DailyPOSReport = () => {
<tfoot> <tfoot>
<tr className='text-gray-800 border-t-2 border-gray-300'> <tr className='text-gray-800 border-t-2 border-gray-300'>
<td className='p-3 font-bold'>TOTAL</td> <td className='p-3 font-bold'>TOTAL</td>
<td className='p-3 text-center font-bold'>{categorySummary?.productCount ?? 0}</td>
<td className='p-3 text-center font-bold'>{categorySummary?.totalQuantity ?? 0}</td> <td className='p-3 text-center font-bold'>{categorySummary?.totalQuantity ?? 0}</td>
<td className='p-3 text-right font-bold'>{formatCurrency(categorySummary?.totalRevenue ?? 0)}</td> <td className='p-3 text-right font-bold'>{formatCurrency(categorySummary?.totalRevenue ?? 0)}</td>
</tr> </tr>
@ -485,19 +476,15 @@ const DailyPOSReport = () => {
<div className='overflow-x-auto'> <div className='overflow-x-auto'>
<table className='w-full table-fixed' style={{ minWidth: '100%' }}> <table className='w-full table-fixed' style={{ minWidth: '100%' }}>
<colgroup> <colgroup>
<col style={{ width: '40%' }} /> <col style={{ width: '50%' }} />
<col style={{ width: '15%' }} /> <col style={{ width: '20%' }} />
<col style={{ width: '15%' }} /> <col style={{ width: '30%' }} />
<col style={{ width: '15%' }} />
<col style={{ width: '15%' }} />
</colgroup> </colgroup>
<thead> <thead>
<tr className='text-gray-800 border-b-2 border-gray-300'> <tr className='text-gray-800 border-b-2 border-gray-300'>
<th className='text-left p-3 font-semibold border-r border-gray-300'>Produk</th> <th className='text-left p-3 font-semibold border-r border-gray-300'>Produk</th>
<th className='text-center p-3 font-semibold border-r border-gray-300'>Qty</th> <th className='text-center p-3 font-semibold border-r border-gray-300'>Qty</th>
<th className='text-center p-3 font-semibold border-r border-gray-300'>Order</th> <th className='text-right p-3 font-semibold'>Pendapatan</th>
<th className='text-right p-3 font-semibold border-r border-gray-300'>Pendapatan</th>
<th className='text-right p-3 font-semibold'>Rata Rata</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -539,8 +526,6 @@ const DailyPOSReport = () => {
{categoryName.toUpperCase()} {categoryName.toUpperCase()}
</td> </td>
<td className='p-3 border-r border-gray-300'></td> <td className='p-3 border-r border-gray-300'></td>
<td className='p-3 border-r border-gray-300'></td>
<td className='p-3 border-r border-gray-300'></td>
<td className='p-3'></td> <td className='p-3'></td>
</tr> </tr>
) )
@ -563,15 +548,9 @@ const DailyPOSReport = () => {
<td className='p-3 text-center text-gray-700 border-r border-gray-200'> <td className='p-3 text-center text-gray-700 border-r border-gray-200'>
{item.quantity_sold} {item.quantity_sold}
</td> </td>
<td className='p-3 text-center text-gray-700 border-r border-gray-200'> <td className='p-3 text-right font-semibold text-gray-800'>
{item.order_count ?? 0}
</td>
<td className='p-3 text-right font-semibold text-gray-800 border-r border-gray-200'>
{formatCurrency(item.revenue)} {formatCurrency(item.revenue)}
</td> </td>
<td className='p-3 text-right font-medium text-gray-800'>
{formatCurrency(item.average_price)}
</td>
</tr> </tr>
) )
}) })
@ -581,10 +560,6 @@ const DailyPOSReport = () => {
(sum, item) => sum + (item.quantity_sold || 0), (sum, item) => sum + (item.quantity_sold || 0),
0 0
) )
const categoryTotalOrders = categoryProducts.reduce(
(sum, item) => sum + (item.order_count || 0),
0
)
const categoryTotalRevenue = categoryProducts.reduce( const categoryTotalRevenue = categoryProducts.reduce(
(sum, item) => sum + (item.revenue || 0), (sum, item) => sum + (item.revenue || 0),
0 0
@ -602,13 +577,9 @@ const DailyPOSReport = () => {
<td className='p-3 text-center font-semibold text-gray-800 border-r border-gray-400'> <td className='p-3 text-center font-semibold text-gray-800 border-r border-gray-400'>
{categoryTotalQty} {categoryTotalQty}
</td> </td>
<td className='p-3 text-center font-semibold text-gray-800 border-r border-gray-400'> <td className='p-3 text-right font-semibold text-gray-800'>
{categoryTotalOrders}
</td>
<td className='p-3 text-right font-semibold text-gray-800 border-r border-gray-400'>
{formatCurrency(categoryTotalRevenue)} {formatCurrency(categoryTotalRevenue)}
</td> </td>
<td className='p-3'></td>
</tr> </tr>
) )
}) })
@ -622,13 +593,9 @@ const DailyPOSReport = () => {
<td className='p-3 text-center font-bold border-r border-gray-300'> <td className='p-3 text-center font-bold border-r border-gray-300'>
{productSummary.totalQuantitySold ?? 0} {productSummary.totalQuantitySold ?? 0}
</td> </td>
<td className='p-3 text-center font-bold border-r border-gray-300'> <td className='p-3 text-right font-bold'>
{productSummary.totalOrders ?? 0}
</td>
<td className='p-3 text-right font-bold border-r border-gray-300'>
{formatCurrency(productSummary.totalRevenue ?? 0)} {formatCurrency(productSummary.totalRevenue ?? 0)}
</td> </td>
<td className='p-3'></td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>

View File

@ -6,8 +6,8 @@ const getToken = () => {
} }
export const api = axios.create({ export const api = axios.create({
baseURL: 'https://api-pos.apskel.id/api/v1', // baseURL: 'https://api-pos.apskel.id/api/v1',
// baseURL: 'http://127.0.0.1:4000/api/v1', baseURL: 'http://127.0.0.1:4000/api/v1',
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },