UPDATE ARCARD SET TRTYPE ="AR1" WHERE LEFT(DOCNO,2) = "IV"
UPDATE ARCARD SET TRTYPE ="DR1" WHERE LEFT(DOCNO,2) = "RI"
UPDATE ARCARD SET TRTYPE ="AR2" WHERE LEFT(DOCNO,2) = "AR"
UPDATE ARCARD SET TRTYPE ="DR2" WHERE LEFT(DOCNO,2) = "DR"
UPDATE ARCARD SET TRTYPE ="BR1" WHERE LEFT(DOCNO,2) = "BR"
UPDATE APCARD SET TRTYPE ="AP1" WHERE LEFT(DOCNO,2) = "RC"
UPDATE APCARD SET TRTYPE ="DP1" WHERE LEFT(DOCNO,2) = "RO"
UPDATE APCARD SET TRTYPE ="AP2" WHERE LEFT(DOCNO,2) = "AP"
UPDATE APCARD SET TRTYPE ="DP2" WHERE LEFT(DOCNO,2) = "DP"
UPDATE APCARD SET TRTYPE ="BP1" WHERE LEFT(DOCNO,2) = "BP"
UPDATE CONFIG SET XINDEX = '01'
UPDATE ARCARD SET REPBAL = AMOUNT_D WHERE LEFT(TRTYPE,2) = "AR"
UPDATE ARCARD SET REPBAL = AMOUNT_D * -1  WHERE LEFT(TRTYPE,2) = "BR"
UPDATE ARCARD SET REPBAL = AMOUNT_D * -1  WHERE LEFT(TRTYPE,2) = "DR"
UPDATE ARCARD SET REFNO = DOCNO WHERE LEFT(TRTYPE,2)="DR" AND (DISCTYPE ="02" OR DISCTYPE="03")
UPDATE APCARD SET REPBAL = AMOUNT_D WHERE LEFT(TRTYPE,2) = "AP"
UPDATE APCARD SET REPBAL = AMOUNT_D * -1  WHERE LEFT(TRTYPE,2) = "BP"
UPDATE APCARD SET REPBAL = AMOUNT_D * -1  WHERE LEFT(TRTYPE,2) = "DP"
UPDATE APCARD SET REFNO = DOCNO WHERE LEFT(TRTYPE,2)="DP" AND (DISCTYPE ="02" OR DISCTYPE="03")
UPDATE ARCARD SET SALETYPE = "01-ขายสด" WHERE SALETYPE="01"
UPDATE ARCARD SET SALETYPE = "02-ขายเชื่อ" WHERE SALETYPE="02"
UPDATE APCARD SET SALETYPE = "01-ซื้อสด" WHERE SALETYPE="01"
UPDATE APCARD SET SALETYPE = "02-ซื้อเชื่อ" WHERE SALETYPE="02"
UPDATE ARCARD SET TAXTYPE = "01 -ราคารวมภาษี" WHERE TAXTYPE="01"
UPDATE ARCARD SET TAXTYPE = "02 -ราคาแยกภาษี" WHERE TAXTYPE="02"
UPDATE ARCARD SET TAXTYPE = "03 -ยกเว้นภาษี/อัตรา 0" WHERE TAXTYPE="03"
UPDATE APCARD SET TAXTYPE = "01 - ราคารวมภาษี" WHERE TAXTYPE="01"
UPDATE APCARD SET TAXTYPE = "02 - ราคาแยกภาษี" WHERE TAXTYPE="02"
UPDATE APCARD SET TAXTYPE = "03 - ยกเว้นภาษี/อัตรา0" WHERE TAXTYPE="03"
UPDATE ARCARD SET VATTYPE = "01-เกณฑ์สิทธิ์" WHERE VATTYPE="01"
UPDATE ARCARD SET VATTYPE = "02-เกณฑ์เงินสด" WHERE VATTYPE="02"
UPDATE APCARD SET VATTYPE = "01-เกณฑ์สิทธิ์" WHERE VATTYPE="01"
UPDATE APCARD SET VATTYPE = "02-เกณฑ์เงินสด" WHERE VATTYPE="02"
UPDATE ADJHEAD SET FLAG = "01-ปรับปรุงเพิ่ม" WHERE FLAG="1"
UPDATE ADJHEAD SET FLAG = "02-ปรับปรุงลด" WHERE FLAG="2"
UPDATE ARCARD SET BILLDOC = "X" WHERE BILLDOC="" OR ISNULL(BILLDOC)
UPDATE APCARD SET BILLDOC = "X" WHERE BILLDOC="" OR ISNULL(BILLDOC)
UPDATE ARCARD SET TAXTYPE = LEFT(TAXTYPE,2)
UPDATE ARCARD SET VATTYPE = LEFT(VATTYPE,2)
UPDATE APCARD SET TAXTYPE = LEFT(TAXTYPE,2)
UPDATE APCARD SET VATTYPE = LEFT(VATTYPE,2)