# JobVersion

**Kind:** Class

**Source:** `Pams/Web/Pams.WebApp/Client/app/models/sales/job-version.model.ts` (line 7)

**Part of:** [Pams](subsystem-pams)

`JobVersion` represents a version of a sales job in the client application. It groups operations that add a unitized item and reset expiration-test state for the current job version.

## Methods

| Method | Signature | Returns |
|---|---|---|
| `addUnitizedItem` | `addUnitizedItem()` | `void` |
| `resetExpirationTest` | `resetExpirationTest()` | `void` |

## Properties

| Property | Type |
|---|---|
| `VersionID` | `number` |
| `VersionDate` | `Date` |
| `IsSelected` | `boolean` |
| `TypeSelected` | `boolean` |
| `UserDisplayName` | `string` |
| `AutoGeneratedSerial` | `boolean` |
| `VersionSerial` | `number` |
| `JobProcessID` | `number` |
| `JobVersionPrice` | `number` |
| `CurrencyID` | `number` |
| `RateToBaseCurrency` | `number` |
| `JobVersionPriceInBaseCurrency` | `number` |
| `PaymentMethodID` | `number` |
| `DeliveryTermID` | `number` |
| `JobVersionStatusID` | `number` |
| `StatusDate` | `Date` |
| `CreatedByUserID` | `number` |
| `ModifiedByUserID` | `number` |
| `ModificationDate` | `Date` |
| `CurrentJobVersionStatusLogID` | `number` |
| `DeliveryTimePeriodID` | `number` |
| `DeliveryTimePeriodCount` | `number` |
| `IsPartialShipment` | `boolean` |
| `CurrencyCode` | `string` |
| `CurrencySymbol` | `string` |
| `ClientOrderNumber` | `string` |
| `SupplierOfferNumber` | `string` |
| `OfferValidationTimePeriodID` | `number` |
| `OfferValidationTimePeriodCount` | `number` |
| `IsCurrent` | `boolean` |
| `SupplierOrderNumber` | `string` |
| `OrderActivationDate` | `Date` |
| `OrderDeliveryDate` | `Date` |
| `OrderDate` | `Date` |
| `OrderBacklog` | `number` |
| `Items` | `JobItem[]` |
| `MileStones` | `OfferMileStone[]` |
| `JobStatus` | `number` |
| `CreatedByUserName` | `string` |
| `JobVersionStatusLabel` | `string` |
| `commissionBase` | `string` |
| `JobVersionParentID` | `number` |
| `CommissionPercentage` | `number` |
| `AgreedCommissionPercentage` | `number` |
| `ContractualCommissionPercentage` | `number` |
| `commissionValidation` | `number` |
| `SupplierID` | `number` |

## Where it refuses work

- `JobVersion` stops the work with an early return when `this.JobVersionPrice <= 0`.
- `JobVersion` stops the work with an early return when `this.Items[0].Description`.
- `JobVersion` stops the work with an early return when `this.OrderActivationDate == null || this.DeliveryTimePeriodCount == null || this.Delivery…`.
- `JobVersion` stops the work with an early return when `this.OrderDeliveryDateCalculated == ""`.
- `JobVersion` stops the work with an early return when `diff < 0`.
- `JobVersion` stops the work with an early return when `this.ContractualCommissionPercentage == -1`.

## Diagram

```mermaid
graph LR
  JobVersion --> AddUnitizedItem["addUnitizedItem()"]
  JobVersion --> ResetExpirationTest["resetExpirationTest()"]
  AddUnitizedItem --> UnitizedItemState["Unitized item state"]
  ResetExpirationTest --> ExpirationTestState["Expiration-test state"]
```

## Usage

```ts
import { JobVersion } from './models/sales/job-version.model';

function updateJobVersion(jobVersion: JobVersion): void {
  jobVersion.addUnitizedItem();

  // Reset expiration-test state before applying updated expiration logic.
  jobVersion.resetExpirationTest();
}
```

## AI Coding Instructions

- Call `addUnitizedItem()` on the active `JobVersion` instance when the sales workflow adds a unitized item.
- Call `resetExpirationTest()` before recalculating or reapplying expiration-test state.
- Keep state changes within `JobVersion` methods instead of duplicating their mutation logic in components.
- Check callers that bind job-version state so UI updates follow these method calls.

## Relationships

- IMPORTS → `JobItem`
- IMPORTS → `OfferMileStone`
- IMPORTS → `AppSettings`
- IMPORTS → `JobVersionStatusE`
- IMPORTS → `JobStatusE`
- IMPORTS → `JobItemStatusE`

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (1)

- `TempInq` — `Pams/Web/Pams.WebApp/Client/app/models/sales/inquiry.model.ts`:17
