4. Invoice - Receive

Input Physical Trades Data

The New Physical Trade function allows users from different departments/teams to access the designated pages to input their data, ensuring a consistent operational workflow and clear delegation of responsibilities for different teams.

Please note that all data input in New Physical Trade will appear in the old Physical Trade page, and vice versa. Trades created in the New Physical Trade page will have their Actions column button disabled, which disallows editing of the trades in the old Physical Trade page.

Alternatively, you may choose to use the old methods to input your data:

1. Manually input physical trades, please access: https://mafint.atlassian.net/wiki/spaces/MCUGX/pages/2022506844

2. Bulk upload physical trades, please access: https://mafint.atlassian.net/wiki/spaces/MCUGX/pages/2022506555


4. Invoice - Receive

If this step is not required yet, please proceed to the next step and return to complete this step when necessary.

This section displays the details of your invoice for all physical trades.

The system will follow this order of priority : Settlement Qty/Price > Estimated Price > Contract Actual Qty/Price > Qty/Provisional Price to calculate data.

1. To access this section, click on ‘Trade', following by 'New Physical Trades' from the navigation sidebar on the left. Click on the 'RECEIVE' tab to access the received invoice (contract is buy so need to make payment so will receive invoice from counterparty) page or 'ISSUE’ to access the issue invoice page (.

2. Click on the drop-down list to display RECEIVED/PAID invoices and the corresponding tables will be reflected accordingly.

The Start Date is 1 month before today's date by default. Please feel free to change the Start Date and End Date (can be any date beyond today's date) accordingly. The dates will remain according to your settings until you log out.

To delete a row, tick the checkbox of the row and click on the 'Delete Row' button located above the table. You may also select multiple rows to delete. 

Several functions are available to assist in the selection of data: 

  • Search bar: Search for keywords in the search bar for relevant data to be displayed

  • Table Headers: 'Sort' and 'Filter' data using the functions in the table headers (Please refer to Table Settings for table functionalities).

A pop up message reminder will appear for user to save data when change page, will apply when user switches between assigned and unassigned page as well as to all conditions when users switch to other page in system or refresh the page

Final Calculation Logic:

  1. when we do portfolio P/L calculation, we use phy_trade actual qty (otherwise qty) and actual_price (otherwise ested_price) in phy_pricing table, which means in settlement tables controlled by risk department

  2. for contract_amt, psl, invoice, we use contract_actual_qty (qty) and contract_actual_price (provisional_price) to calculate.

    1. BE in dropdown list in psl, invoice

    2. FE un_inc_amt, un_payment_amt in psl, invoice table

    3. FE contract_amt … in phy_trade table

The right logic should be: for each trade, once they key the price and qty but not yet record PSL or INVOICE for this contract, PSL AMT, INV QTY, INV AMT should be 0 and BAL AMT , UN INV QTY , UN INV AMT should not be null.

Initial BAL AMT, UN INV QTY, UN INV AMT formulas have no change

 

Steps:

1、When users generate invoices, they first add a new row and select the contract no.

The setting for the contract no should be similar to that for receiving invoices, with a dropdown list displaying the UN INV QTY AND UN INV AMT. Users can manually enter the Counterparty to filter the range of contracts.

2、After selecting the contract no, the system will autofill related columns(MAIN CONTRACT NO, SPECIFICATION, UNIT, COUNTERPARTY, QTY, PRICE), as well as match the corresponding ITEMS (inv_product) in the company data with the product. The system will return a dropdown list for the user to select ITEMS.

3、After selecting the ITEMS, If this ITEM corresponds to only one INVOICE NO, the system will automatically fill in the INVOICE NO and the corresponding tax rate.

4、They need to export the invoicing information, and the template is attached. It should be considered whether to export directly or design a new UI if necessary.

 

3. RECEIVED INVOICE:

Please select from the Unassigned/Assigned drop-down list to select

  • Unassigned - will show all invoices without Contract No.

  • Assigned - will show all invoices with Contract No

 

Upload Invoice

You are highly recommended to upload your invoice into the system (the units will be captured automatically 吨— Metric Ton; KG— kilogram), instead of manually inputting the data (click '+ Add Row' button located above the table). Depending on the data in your invoice, once you upload your invoice, the following fields should be filled:

  • Date

  • PSL Type

  • Ledger Type

  • Invoice Prod

  • Unit

  • Qty

  • Amount

  • Total Price & Tax

  • Counterparty

For Aggregate : after user uploads the file, system will aggregate all the rows with same “开票日,商品名称,规格型号,单位,税率,销方名称, 税收分类编码“ and recalculate the sum of “数量,金额,税额,价税合计”

the new template delete the TOTAL PRICE & TAX column, now when uploading, system will first upload AMOUNT and TAX AMT, then fill this column ( AMOUNT + TAX AMT)

new aggregate rule:

After uploading the file, system should aggregate all the rows with same “开票日,商品名称(货物或应税劳务名称 in template),规格型号,单位,税率,销方名称, 税收分类编码“ and recalculate the sum of “数量,金额,税额,价税合计(金额+税额)”

You will then be required to input Company and Ccy (Currency) before saving the data. Once saved, the invoice item will remain in the Unassigned table until you are ready to assign the contract number.

Once you are ready to assign contract number to the invoice, you may enter the Unassigned table and select from the Contract No. drop down list to assign the contract number, and the relevant data (Contract No., Main Contract No., Un Inv Amt) will be updated accordingly. Click Save to save the data and the invoice item will be shifted to the Assigned table. The same steps will be repeated until the invoice item is fully assigned and Un Inv Amt will be 0.

  • Un Inv Amt = Contract Amount (viewable in Contract No. dropdown list) - Invoice Amount (Amount)

    • Will be updated immediately in Contract No. drop down list before saving once Invoice Amount (Amount) is input

 

Manual Input

If you choose to add row to input manually, if you want to select from Contract No. to auto fill details in the row according to the contract’s details in the dropdown list (if data is available), you must fill in Amount first. Contract No. of trades input in New Physical Trade table can be selected to auto fill details in the row according to the contract’s details (Company, Unit, Qty, Un Inv Amt and Counterparty if data is available). Otherwise, you may manually input the compulsory fields highlighted in red.

CONTRACT NO 合同编号: Key column linked to “PHYSICAL TRADE STATUS” 现货合同状态 app to monitor payment and invoice record.

  • If Contract No. has not been selected yet aka these fields are empty, they will be auto-filled: Main Contract No., Company, Unit, Qty, Un Inv Amt and Counterparty, if “Contract No.” is selected

  • If Contract No. has been selected previously aka these fields are already filled, only Company, Un Inv Amt, Counterparty will change according to the Contract No. So you will need to adjust the rest of the fields manually

 

Please refer to below for more information on how to input the fields. Cells highlighted in red in the table are compulsory fields and are thus necessary to input:

  • Invoice ID.: Invoice number, if applicable

  • Date: Date invoice is issued

  • PSL Type: Will be INVOICE by default

  • Ledger Type:Determine if it is a paid or received invoice, it is RECEIVED by default if the invoice dropdown list selected is RECEIVED; amount will always be positive

    • Paid: Amount paid to counterparty

    • Received: Amount received from counterparty

  • Invoice Prod: Name of product listed in invoice

  • Invoice Spec: Specification of product listed in invoice

  • Contract No.: Select from the dropdown list to select the Contract Number, and the corresponding data input in Trades tab will be auto-filled here (Main Contract No., Company, Unit, Qty, Un Inv Amt and Counterparty if data is available). These items will be displayed in the drop down list:

    • Contract No.

    • Main Contract No.

    • Phy Trade ID

    • Company

    • Counterparty

    • Product

    • Qty: Contract Actual Quantity or Quantity input in Trades tab

    • Price: Contract Actual Price in Trades tab

    • Un Inv Amt: Refers to invoice amount that has not been accounted for (not saved in Invoice table), you will be required to input Amount before you select Contract No., otherwise it will be Contract Amt by default once Contract No. is selected. Once you input values in Amount column to account for the invoice amount, the Un Inv Amt will be recalculated

      • Un Inv Amt = Contract Amount (viewable in Contract No. dropdown list) - Invoice Amount (Amount)

    • Contract Amt: Contract Actual Qty * Contract Actual Price

  • Main Contract No.: Main contract number, if applicable

  • Company: Name of company

  • Unit: Unit of product listed in invoice

  • Qty: Quantity of product listed in invoice

  • Amount: Input the amount to account for the invoice. Once you input values in Amount column to account for the invoice amount, the Un Inv Amt will be recalculated. For example, if the uninvoice amount is 1000, if you input 900 in the Amount column, the Un Inv Amt will be 100. This means that the invoice amount of 100 has not been issued yet. You may repeat the same step to make Un Inv Amt 0 which means that the invoice for the trades has been completely settled.

  • Un Inv Amt: Refers to invoice amount that has not been accounted for/settled. Once the invoice amount has been input in Invoice tab, the uninvoiced amount will be recalculated. For example, if the uninvoice amount is 1000, if you input 900 in the Amount column, the Un Inv Amt will be 100. This means that the invoice amount of 100 has not been issued yet. You may repeat the same step to make Un Inv Amt 0 which means that the invoice for the trades has been completely settled.

  • Tax Amt: AMOUNT * TAX RATE change to psl_amt_tax - psl_amt

  • Total Price & Tax: AMOUNT + TAX AMT

  • Ccy: Invoice currency

  • Counterparty: Name of counterparty

 

Split Function

To split your invoice amount, tick a row and click on Split. You can only split 1 invoice at any one time. The row you have selected will be reflected in the table on the left. 3 split rows on the right are selected by default, you may click on Add Row to add more rows or tick the row and click on Delete Row to delete the rows. If the split amount is negative, the ledger type will be Paid; if the split amount is positive, the ledger type will be Received.

Once you have determined the number of split rows on the right, only Total Price & Tax column must be input in order to save successfully (you may keep the first row empty and input the other rows first, and once other rows are input, the first row will be auto calculated)

You may manually input or change the columns according to your requirements:

  • Invoice No.

  • PSL Type: INVOICE/PAYMENT

  • Contract No. (once selected, corresponding Main Contract No. and Company will be autofilled accordingly)

  • Total Price & Tax: Input this column and Qty and Amount will be auto calculated by proportion and auto-filled. (you may keep the first row empty and input the other rows first, and once other rows are input, the first row will be auto calculated)

Once done, click on Submit at the bottom left corner of the page to save the data.

 

The row on the left will thus be deleted, and the newly created rows on the right will be displayed in the Invoice table.

You may repeat the same steps to split the invoice amounts.

 

Recalculate Function

 

 

Please select from the Unassigned/Assigned drop-down list to select

  • Unissued - will show all invoices without Contract No.

  • Issued - will show all invoices with Contract No.

Please refer to below for more information on how to input the fields. Cells highlighted in red in the table are compulsory fields and are thus necessary to input:

  • Invoice ID.: Invoice number, if applicable

  • Date: Date invoice is issued

  • Contract No.: Select from the dropdown list to select the Contract Number, and the corresponding data input in Trades tab will be auto-filled here (Main Contract No., Company, Unit, Qty, Un Inv Amt and Counterparty if data is available). When choose contract no, if there is only one 开票品名 and one 税收分类编码, tax rate should also auto fill, also check if the 税收分类编码 is right

    • Contract No.

    • Main Contract No.

    • Phy Trade ID

    • Company

    • Counterparty

    • Product

    • Qty: Contract Actual Quantity or Quantity input in Trades tab

    • Price: Contract Actual Price in Trades tab

    • Un Inv Amt: Refers to invoice amount that has not been accounted for (not saved in Invoice table), will be Contract Amt by default once Contract No. is selected. Once you input values in Amount column to account for the invoice amount, the Un Inv Amt will be recalculated

    • Contract Amt: Contract Actual Qty * Contract Actual Price

  • Main Contract No.: Main contract number, if applicable

  • Product: Name of product

  • Specification: Specification of product (not compulsory)

  • Company: Name of company

  • Unit: Unit of product listed in invoice (if invoice is chinese, system can capture unit like kilogram 千克 and metric ton 吨

  • Items:

  • Counterparty: Name of counterparty

  • Qty: Quantity of product listed in invoice; Priority:CONTRACT ACTUAL QTY > QTY

  • Price: Price listed in invoice; Priority:CONTRACT ACTUAL PRICE > PROVISIONAL PRICE

  • Amt: QTY * PRICE

  • Amt before Tax: AMT - AMT BEFORE TAX

  • Tax Amt:

  • Currency: Auto fill by CONTRACT CCY (when user chooses Contract No.)

  • Remarks

  • Invoice No.

  • If Tax Incentive: if inv_tax_rate = 0 : 1; else : 0

  • Tax Incentive Content: if inv_tax_rate = 0 : zero tax (免税); else : null

  • Zero Tax Indicator: if inv_tax_rate = 0 : 1; else : null

  • Invoice Type: if inv_tax_rate = 0 : General(普票); else : Special(专票)

  • Tax Rate: Invoice tax rate

 

 

Logic:

  • In 5 conditions FE should change the un payment in dropdown list of contract (before save):

1: Assign contract no to PSL

2: Change the contract no (from A to B)

3: Delete the contract no

4: Delete row with contract no

5: Change psl amt with contract no

  • 1、UN INV AMT (未开票金额) - invoice

    2、未收/付款 - PSL

    • un_inv = CONTRACT AMT - inv_amt

      un_payment = CONTRACT AMT - payment_amt

  • in invoice table and psl table, inv_amt and psl_amt in Database should be always positive.

  • we use ledger type to control the amt should be positive or negative.

  • if split in psl into negative, I suggest we update ledger type to PAID (negative), RECEIVED (positive).

  • When users choose the “Assigned(已分配)” in drop down list,table will show all PSL or invoice with contract no.; when users choose “Unassigned(未分配)”, table will show all PSL or invoice without contract no.

 

Group Function - User Access Management

Group-level(ops) personnel are not allowed to modify or delete PSL and invoicing information imported under company-level accounts. They can only assign under the contract number or split(allocate) the records.

Non-creator should only be allowed to edit following columns:

ps ledgers:

CONTRACT NO.

REMARKS

invoice:

INVOICE ID

CONTRACT NO.

logic in FE

  1. this is only apply to update manually in table and user is not creator

    1. if there is psl_id, then only allow to update columns above

    2. if there is no psl_id, it means new insert data, then all columns are allowed to edit

  2. only creator is able to delete rows manually in table (select row and press delete button)


RECEIVE allocate window - UN INV QTY issue fixed: User manually adjusts the quantity and amount of contracts to match the numbers exported from the tax system. However, in the 3rd panel, UN INV QTY still appears in red because the system did not treat “0.0000” as 0.

Amount, below 0.05 will assume as 0

Qty, below 0.0005 will assume as 0

 

 

After user assigned the contract in the RECEIVE table, they noticed an additional record in the unassigned page. The underlying cause of this bug is similar to MAF-3861, where the system failed to treat "0.00" in INV AMT as 0, resulting in an extra update of a new record.

 

RECALCULATE bug in receive and issue

In invoice receive and issue table, after recalculate, un_inv_qty is not updated.

un_inv_qty = un_inv_qty - (con_qty or psl_qty)

 

 

  1. Add pop up message for Recalculate in ps ledger and invoice

when user click on recalculate in ps ledger and invoice (receive and issue), add a pop up message with the following:

Successful!

Recalculation has been completed, please save your data.

成功!

重新计算已完成,请保存您的数据。

only can recalculate trades with contract no, so need tick first and click recalculate

Failed!

Please select row(s) with contract to recalculate.

失败!

请选拥有合约编号的行(至少一个)以重新计算

 

PS ledger and receive invoice assigned/unassigned and issued/unissued drop down list; if filter in the assigned table, when i changed to unassigned and then back to assigned, the filter is gone bug fixed

 

Receive invoice allocate issues fixed:

  1. in 2nd panel con qty should not be empty

  2. in 2nd panel, un inv amt should be same in in the 3rd panel (contract amt - inv amt)

Row order issue

order by psl_id DESC

for table psl, receive and issue

 

Receive table - add un inv qty column behind con qty

unit convert in FE for un inv qty match and calculate

un_inv_qty from BE response to FE is based on phy trade contract unit.

when invoice receive or issue, the inv_unit could be different from contract_unit.

when auto match un_inv_qty in allocate window or receive, issue table, FE need to convert to contract unit first, then auto match.

try invoice unit different from contract unit. FE will do auto convert first and then to calculate un inv qty in FE

 

for psl and invoice both

  1. please make sure issue table also pass phy_trade_ids to BE to update. (6 points)

  2. make sure real time update un_inv_qty and un_inv_amt

for testing:

  1. delete row with contract_no

  2. unassign contract_no

  3. assign contract_no

  4. insert new row with contract_no

  5. update row with contract_no (update anything)

  6. all the above actions without contract_no

for 1 to 5 point, payment amt, invoice_amt and invoice qty should be update accordingly, to check if the number is correct