//native
type SageIntacct = {
token: string
}
/**
* Create a project contract
* Creates a new project contract. You must specify a unique ID when creating a project contract unless document sequencing is configured, in which case the ID is auto-generated.
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
href?: string
name?: string
project?: { key?: string; id?: string; name?: string; href?: string }
location?: { key?: string; id?: string; name?: string; href?: string }
customer?: { key?: string; id?: string; name?: string; href?: string }
contractDate?: string
description?: string
projectContractType?: { key?: string; id?: string; href?: string }
architect?: { key?: string; id?: string; href?: string }
isBillable?: false | true
attachment?: { key?: string; id?: string; href?: string }
status?: 'active' | 'inactive'
summary?: {
totalPrice?: string
originalPrice?: string
revisionPrice?: string
approvedChangePrice?: string
pendingChangePrice?: string
otherPrice?: string
forecastPrice?: string
}
billing?: {
billedPrice?: string
totalBilledNetRetainage?: string
percentBilled?: string
percentBilledNetRetainage?: string
totalRetainageHeld?: string
totalRetainageReleased?: string
retainageBalance?: string
balanceToBill?: string
balanceToBillNetRetainage?: string
totalPaymentsReceived?: string
netTotalBilled?: string
netTotalPaymentsReceived?: string
subtotalBilledAsTax?: string
subtotalBilledAsDiscount?: string
subtotalBilledAsCharge?: string
lastApplicationNumber?: string
}
excludeFromWIPReporting?: false | true
scope?: string
inclusions?: string
exclusions?: string
terms?: string
schedule?: {
scheduledStartDate?: string
actualStartDate?: string
scheduledCompletionDate?: string
revisedCompletionDate?: string
substantialCompletionDate?: string
actualCompletionDate?: string
noticeToProceedDate?: string
responseDueDate?: string
executedOnDate?: string
scheduleImpact?: string
}
internalReference?: {
referenceNumber?: string
initiatedBy?: { key?: string; id?: string; name?: string; href?: string }
verbalApprovalBy?: {
key?: string
id?: string
name?: string
href?: string
}
issuedBy?: { key?: string; id?: string; name?: string; href?: string }
issuedOnDate?: string
approvedBy?: { key?: string; id?: string; name?: string; href?: string }
approvedOnDate?: string
signedBy?: { key?: string; id?: string; name?: string; href?: string }
signedOnDate?: string
source?: string
sourceReferenceNumber?: string
}
externalReference?: {
referenceNumber?: string
verbalApprovalBy?: { key?: string; id?: string; href?: string }
approvedBy?: { key?: string; id?: string; href?: string }
approvedOnDate?: string
signedBy?: { key?: string; id?: string; href?: string }
signedOnDate?: string
}
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
entity?: { key?: string; id?: string; name?: string; href?: string }
} & {}
) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/construction/project-contract`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago