« Back to History
cash_payment_bulk_insert.php
|
20260721_154032.php
Initial Bulk Import
Copy Code
<?php function cash_payment_bulk_insert( PDO $pdo, int $company_id, array $rows, int $year, int $month, string $period, int $user_id ) { $sql = " INSERT INTO cash_payment_detail (company_id, year, month, period, payment_head, person_type, person_id, person_name, amount, is_paid, created_by) VALUES (?,?,?,?,?,?,?,?,?,0,?) ON DUPLICATE KEY UPDATE amount = VALUES(amount) "; $st = $pdo->prepare($sql); foreach ($rows as $r) { $st->execute([ $company_id, $year, $month, $period, $r['head'], $r['person_type'], $r['person_id'], $r['person_name'], $r['amount'], $user_id ]); } }