Here I'm presenting few guidelines to customize the invoice number format.
The out of the box format for the invoice number is :
Default Invoice : B1-BILLNO, e.g. B1-1234
We will take the case to customized Invoice number in the following format :
Customized Invoice Number : [ACCOUNT_POID]-BILLNO, e.g. 0000098976-1234
Where account_poid = 98976
For implementing the above change, we need to do the following steps :
1]. Customize the policy opcode : PCM_OP_BILL_POL_SPEC_BILLNO opcode needs modification to read sequence id(poid) from account object POID and replace B1 from default invoice number with the sequence id.
To customize the PCM_OP_BILL_POL_SPEC_BILLNO, need to edit fm_bill_pol_spec_billno() function of fm_bill_pol_spec_billno.c
fm_bill_pol_spec_billno(
{
/*****************************************
* Set the BILL_NO field according to poid
*****************************************/
vp = PIN_FLIST_FLD_GET(b_flistp,PIN_FLD_BILL_NO,1,ebufp);
if((vp == (void *)NULL || (strlen((char *)vp) <= 0)) { // START OF IF BLOCK
............
............
poid_db = PIN_POID_GET_DB(pdp);
poid_id = PIN_POID_GET_ID(pdp);
business_param_invoice_sequence_id_lt = psiu_bparams_get_int(ctxp, PSIU_BPARAMS_INVOICING_PARAMS,PSIU_BPARAMS_LENGHT_OF_SEQUENCE_ID,ebufp);
printf(%s is the bill no", billno);
sprintf(billno,"%llu",poid_id);
/*start sequence */
PIN_ERR_LOG_MSG(PIN_ERR_LEVEL_DEBUG,"--billno and poid--");
PIN_ERR_LOG_MSG(PIN_ERR_LEVEL_DEBUG,billno);
PIN_ERR_LOG_MSG(PIN_ERR_LEVEL_DEBUG,poid_id);
PIN_FLIST_FLD_SET(b_flistp,PIN_FLD_BILL_NO,(void *)billno,ebufp);
}//END OF IF BLOCK
*out_flistpp = b_flistp;
return;
}
The out of the box format for the invoice number is :
Default Invoice : B1-BILLNO, e.g. B1-1234
We will take the case to customized Invoice number in the following format :
Customized Invoice Number : [ACCOUNT_POID]-BILLNO, e.g. 0000098976-1234
Where account_poid = 98976
For implementing the above change, we need to do the following steps :
1]. Customize the policy opcode : PCM_OP_BILL_POL_SPEC_BILLNO opcode needs modification to read sequence id(poid) from account object POID and replace B1 from default invoice number with the sequence id.
To customize the PCM_OP_BILL_POL_SPEC_BILLNO, need to edit fm_bill_pol_spec_billno() function of fm_bill_pol_spec_billno.c
fm_bill_pol_spec_billno(
{
/*****************************************
* Set the BILL_NO field according to poid
*****************************************/
vp = PIN_FLIST_FLD_GET(b_flistp,PIN_FLD_BILL_NO,1,ebufp);
if((vp == (void *)NULL || (strlen((char *)vp) <= 0)) { // START OF IF BLOCK
............
............
poid_db = PIN_POID_GET_DB(pdp);
poid_id = PIN_POID_GET_ID(pdp);
business_param_invoice_sequence_id_lt = psiu_bparams_get_int(ctxp, PSIU_BPARAMS_INVOICING_PARAMS,PSIU_BPARAMS_LENGHT_OF_SEQUENCE_ID,ebufp);
printf(%s is the bill no", billno);
sprintf(billno,"%llu",poid_id);
/*start sequence */
PIN_ERR_LOG_MSG(PIN_ERR_LEVEL_DEBUG,"--billno and poid--");
PIN_ERR_LOG_MSG(PIN_ERR_LEVEL_DEBUG,billno);
PIN_ERR_LOG_MSG(PIN_ERR_LEVEL_DEBUG,poid_id);
PIN_FLIST_FLD_SET(b_flistp,PIN_FLD_BILL_NO,(void *)billno,ebufp);
}//END OF IF BLOCK
*out_flistpp = b_flistp;
return;
}
This will not change the original bill number referred to in item_no column of item_t
ReplyDeleteTo include this psiu_bparams_get_int function what we have to add in our program. because it is showing an error psiu_bparams_get_int undefined.
ReplyDelete