# Pay Run Import Mapping

<p class="doc-lead">Pay Run Import Mapping is a settings master (collection <code>pyrim</code>) that maps CSV or Excel column headers to pay-run fields. Configure mappings before using <a href="#/payroll/pay-run?id=import">Pay Run → Import from File</a> so uploaded files are parsed correctly for payments, deductions, and header day-count fields.</p>

<div class="doc-toc">
<p class="doc-toc-title">On this page</p>
<div class="doc-toc-section">
<span class="doc-toc-group-title">Getting started</span>
<div class="doc-toc-links">
<a href="#/payroll/pay-run-import-mapping?id=overview">Overview &amp; List View</a>
<a href="#/payroll/pay-run-import-mapping?id=quick-start">Quick Start</a>
</div>
</div>
<div class="doc-toc-section">
<span class="doc-toc-group-title">Form reference</span>
<div class="doc-toc-links">
<a href="#/payroll/pay-run-import-mapping?id=field-types">Mapping Types</a>
<a href="#/payroll/pay-run-import-mapping?id=create-fields">Create / Edit Fields</a>
<a href="#/payroll/pay-run-import-mapping?id=built-in-aliases">Built-in Aliases</a>
</div>
</div>
<div class="doc-toc-section">
<span class="doc-toc-group-title">More</span>
<div class="doc-toc-links">
<a href="#/payroll/pay-run-import-mapping?id=example-mappings">Example Mappings</a>
<a href="#/payroll/pay-run-import-mapping?id=import-flow">Import Flow</a>
<a href="#/payroll/pay-run-import-mapping?id=related">Related</a>
</div>
</div>
</div>

<hr class="doc-section-divider">

<h2 id="overview">Overview &amp; List View</h2>

Go to <b>Payroll → Settings → Pay Run Import Mapping</b>.

The list shows all configured column mappings used when importing pay runs from a file.

<b>List columns</b>

| **Column** | **Shows** |
|------------|-----------|
| Id | System reference. |
| Name | Mapping name (e.g. Monthly Payroll Import). |
| Column Header | CSV/Excel column header text to match. |
| Type | Mapping type — Payment, Deduction, or Header. |
| Target Field | Pay-run field or category the column maps to. |
| Payment / Deduction Category | Category when type is Payment or Deduction. |
| Status | Active or Suspended. |

<b>Advanced Filters</b>

Id, Name, Type, Column Header, Payment Category, Deduction Category, Status, Created Date.

<b>List row actions</b>

| **Action** | **Description** |
|------------|-----------------|
| Edit | Opens the mapping for editing. |
| Delete | Removes the mapping. |
| View | Opens read-only view. |

<hr class="doc-section-divider">

<h2 id="quick-start">Quick Start — Create a Mapping</h2>

1. Go to <b>Payroll → Settings → Pay Run Import Mapping</b> and click <b>New</b>.
2. Enter a <b>Name</b> for the mapping set (for reference).
3. Set <b>Column Header</b> — the exact text (or alias) expected in the import file header row.
4. Choose <b>Type</b>:
   - <b>Header</b> — maps to a pay-run header field (employee code, LOP days, etc.).
   - <b>Payment</b> — maps to a salary payable line using a payment category.
   - <b>Deduction</b> — maps to a deduction line using a deduction category.
5. Select the <b>Target Field</b> or category depending on type.
6. Click <b>Save</b>.

Repeat for every column in your import template. Then use <a href="#/payroll/pay-run?id=import">Pay Run → Import from File</a> to upload CSV or Excel files.

<hr class="doc-section-divider">

<h2 id="field-types">Mapping Types</h2>

<h3>Header type</h3>

Maps a file column to a pay-run header field. One row per employee in the import file.

| **Target field** | **Description** |
|------------------|-----------------|
| employeeCode | Employee code — required to identify the employee. |
| noOfLOPDays | Loss-of-pay days for the period. |
| noOfWorkingDays | Working days used for salary divisor. |
| noOfPaidLeaves | Paid leave days credited. |
| noOfHolidayOTDays | Holiday overtime days. |
| leaveSalaryDays | Days to encash as leave salary. |
| extraPayableDays | Extra payable days. |
| notes | Notes printed on payslip. |
| internalNotes | Internal notes (not on payslip). |

<h3>Payment type</h3>

Maps a file column to a <b>Salary Payable</b> line. Select a <a href="#/payroll/payment-categories">Payment Category</a> (e.g. Basic, HRA, Allowance, Overtime). The column value is the amount for that category on the pay run.

<h3>Deduction type</h3>

Maps a file column to a <b>Deduction</b> line. Select a <a href="#/payroll/deduction-categories">Deduction Category</a> (e.g. Cash Advance, Loss of Pay, Loan). The column value is the deduction amount.

<p><b>Cash advance columns:</b> When the deduction category is Cash Advance, the import distributes the amount across pending <a href="#/payroll/cash-advance-voucher">Cash Advance Vouchers</a> for that employee (oldest voucher first).</p>

<hr class="doc-section-divider">

<h2 id="create-fields">Create / Edit Fields</h2>

| **Field** | **Description** |
|-----------|-----------------|
| Name * | Label for this mapping (for admin reference). |
| Column Header * | Header text in the import file. Case-insensitive match against built-in aliases when no custom mapping exists. |
| Type * | Header, Payment, or Deduction. |
| Target Field | For Header type — which pay-run header field to populate. |
| Payment Category | For Payment type — earning category (Basic, HRA, etc.). |
| Deduction Category | For Deduction type — deduction category (Cash Advance, LOP, etc.). |
| Status | Active (used during import) or Suspended (ignored). |
| Notes | Optional admin notes. |

<hr class="doc-section-divider">

<h2 id="built-in-aliases">Built-in Aliases</h2>

<p>The import engine recognizes common header aliases even without a custom mapping. Custom mappings in this master override or extend these defaults.</p>

| **Built-in alias** | **Maps to** |
|--------------------|-------------|
| Employee Code, Emp Code, Employee ID | employeeCode (header) |
| LOP, LOP Days, Loss of Pay | noOfLOPDays (header) |
| Workdays, Working Days, Work Days | noOfWorkingDays (header) |
| Paid Leaves, Paid Leave Days | noOfPaidLeaves (header) |
| Holiday OT, Holiday OT Days | noOfHolidayOTDays (header) |
| Leave Salary Days | leaveSalaryDays (header) |
| Extra Payable Days, Extra Days | extraPayableDays (header) |
| Basic, Basic Salary | Payment — Basic category |
| HRA, House Rent | Payment — HRA category |
| Cash Advance, Advance | Deduction — Cash Advance category |

<p>If your file uses non-standard headers, create explicit mappings here so the import parser resolves them correctly.</p>

<hr class="doc-section-divider">

<h2 id="example-mappings">Example Mappings</h2>

<p>Typical mapping set for a monthly payroll CSV:</p>

| **Column Header** | **Type** | **Target / Category** |
|-------------------|----------|----------------------|
| Emp Code | Header | employeeCode |
| LOP Days | Header | noOfLOPDays |
| Work Days | Header | noOfWorkingDays |
| Paid Leaves | Header | noOfPaidLeaves |
| Basic | Payment | Basic (payment category) |
| HRA | Payment | HRA (payment category) |
| Transport Allowance | Payment | Transport (payment category) |
| Cash Advance Recovery | Deduction | Cash Advance (deduction category) |
| Loan Deduction | Deduction | Loan (deduction category) |

<p><b>Sample CSV row:</b></p>

```
Emp Code,Work Days,LOP Days,Basic,HRA,Cash Advance Recovery
EMP001,26,2,25000,8000,1500
```

<p>On import, the system creates one pay run for EMP001 with header day counts, payment lines for Basic and HRA, and a cash-advance deduction distributed across pending vouchers.</p>

<hr class="doc-section-divider">

<h2 id="import-flow">Import Flow</h2>

<p>End-to-end steps linking this master to pay-run import:</p>

<ol>
<li>Configure mappings in <b>Pay Run Import Mapping</b> (this screen).</li>
<li>Go to <b>Payroll → Payrun</b> and open <b>Import</b> from the list header.</li>
<li>Set <b>Year, Month, Period</b>, and optional <b>Process Date</b>.</li>
<li>Upload <b>.csv, .xlsx, or .xls</b> (max 10 MB).</li>
<li>Choose <b>Dry run</b> to validate without saving, or import with optional <b>Save and approve each row</b>.</li>
</ol>

<p>See the full import options and behavior in <a href="#/payroll/pay-run?id=import">Pay Run — Import from File</a>.</p>

<hr class="doc-section-divider">

<h2 id="faq">FAQ</h2>

<b>Must every CSV column have a mapping?</b><br>
Unmapped columns are ignored. Required pay-run fields (employee code, payment/deduction categories) need explicit mappings or standard header aliases.

<b>What happens if employee code is not found?</b><br>
That import row fails validation. Dry run shows the error without creating a pay run — fix codes or employee master first.

<b>Can I map the same column to multiple payment categories?</b><br>
No. Each column maps to one target — create separate columns in your file for Basic, HRA, and other components.

<b>Does import respect salary calculation settings?</b><br>
Header day counts and line amounts from the file load as entered. Attendance-based recalculation applies when you Refetch on the created draft pay run.

<b>What is Save and approve each row on import?</b><br>
Approves each successfully imported pay run immediately. Use dry run first — errors on one row do not roll back other approved rows when batch approving.

<b>Can I import cash advance recovery without a voucher?</b><br>
Import distributes the deduction amount across pending cash advance vouchers for the employee using the Cash Advance deduction category mapping.

<hr class="doc-section-divider">

<h2 id="related">Related</h2>

<ul>
<li><a href="#/payroll/pay-run?id=import">Pay Run — Import from File</a></li>
<li><a href="#/payroll/payment-categories">Payment Categories</a></li>
<li><a href="#/payroll/deduction-categories">Deduction Categories</a></li>
<li><a href="#/payroll/payroll-settings-config">Payroll Settings</a> — salary calculation rules applied after import</li>
</ul>
