GWM: payout upload

This commit is contained in:
Gowtham M 2026-04-03 17:25:07 +05:30
parent 8316178230
commit c3e898c980
2 changed files with 27 additions and 0 deletions

View File

@ -135,6 +135,7 @@ $routes->group('api', ['filter' => ["jwtAuth:1,2,3,4,agent","appSignature"] ], f
$routes->get("policy/fuelTypeMaster", "PolicyController::fuelTypeMaster");
$routes->get("policy/softdelete", "PolicyController::softdelete");
$routes->get('policy/downloadPendingCommissionExcel', 'PolicyController::downloadPendingCommissionExcel');
$routes->get('policy/downloadCommissionUploadSampleExcel', 'PolicyController::downloadCommissionUploadSampleExcel');
$routes->post('policy/uploadCommissionExcel', 'PolicyController::uploadCommissionExcel');
$routes->post('policy/payoutInilneEditUpdate', 'PolicyController::payoutInilneEditUpdate');

View File

@ -1615,6 +1615,32 @@ class PolicyController extends ResourceController
}
}
/**
* GET: static sample .xlsx for clients (same columns as uploadCommissionExcel).
* No filters; use downloadPendingCommissionExcel for real pending rows from the database.
*/
public function downloadCommissionUploadSampleExcel()
{
try {
$header = ['Agent Code', 'Policy Number', 'Payout Amount'];
// Example rows — clients replace with real data or delete before upload.
$dataRows = [
['AG001', 'YOUR-POLICY-NUMBER-1', '1500.00'],
['AG002', 'YOUR-POLICY-NUMBER-2', ''],
];
$title = 'Sample: fill Payout Amount, keep Agent Code matching the policy, upload via policy/uploadCommissionExcel';
$fileName = 'commission_payout_upload_sample.xlsx';
$this->streamPendingCommissionExcel($header, $dataRows, $title, $fileName);
} catch (\Throwable $e) {
return $this->respond([
'status' => 'failed',
'code' => 500,
'message' => $e->getMessage(),
], 500);
}
}
/**
* POST multipart field: commission_excel (xlsx). Updates partner_policy.commission_amount by policy number.
*/