Convert Long UPC to short UPC

Issue No: IC-1746
Created 1/8/2016 5:34:56 AM
Type Task
Priority Major
Status Closed
Resolution Fixed
Fixed Version 16.1
Description Logic to convert Long UPC to Short UPC   Notes: We have to follow logics given in all the stpes from 1 to 8, like for example if the step 2 is satisfied we have to even follow the logic given in the steps 3 to 8 if condition satisifes.   Long UPC Codes are 14 digits but user should be able to enter 13 digit and last digit is considered as check digit and even display first 13 digits to the user.   1.If the number of digits of Long UPC entered are less than 13 digits add leading zeroes to make it 13 digits and move zero to the 14th digit.   Ex: If the user entered Long UPC as 2840000003 take 00028400000030 as long upc for consideration,as per step 1(If the number of digits of Long UPC entered are less than 13 digits add leading zeroes to make it 13 digits and move zero to the 14th digit).   2.Check if 9th digit to 12th Digit of Long UPC are zero and 13th digit of Long UPc is greater than 4 a. 4th to 9th digits of long upc becomes first 5 digits of short upc. b. 13th digit of long upc becomes 6th digit of short upc.   3.Check if 8th digit to 12th Digit of Long upc are zero a. 4th to 7th digits of long upc becomes first 4 digits of short upc. b. 13th digit of long upc becomes 5 digit of short upc. c. move 4 to last digit of short upc(6th Digit of short upc).   4.Check if 7th to 11th digit of long upc are zero a. 4th to 6th digits of long upc becomes first 3 digits of short upc. b. 12th to 13th digit of Long UPC becomes 4th to 5th digits of short upc. c. move 3 to last digit of short upc(6th Digit of short upc).   5.Check if 6th to 10th digit of Long upc are 20000 a. 4th to 5th digits of long upc becomes first 2 digits of short upc b. 11th to 13th digits of Long UPC becomes 3rd to 5th digit of short upc. c. move 2 to last digit of short upc(6th Digit of short upc).   6.Check if 6th to 10th digit of Long Upc are 10000 a. 4th to 5th digits of long upc becomes first 2 digits of short upc b. 11th to 13th digits of Long UPC becomes 3rd to 5th digit of short upc. c. move 1 to last digit of short upc(6th Digit of short upc).   7.Check if 6th to 10th digits of Long Upc are 00000 a. 4th to 5th digits of long upc becomes first 2 digits of short upc b. 11th to 13th digits of Long UPC becomes 3rd to 5th digit of short upc. c. move 0 to last digit of short upc(6th Digit of short upc).   8.Do not trim the leading zeroes of Long UPC, if the 3rd to 8th digit of Long UPC is greater than 99,999 dont convert to short UPC I.e keep short UPC as NULL.   Note:   If none of the above condition(step2 to step8) satisfies, dont Convert Long UPC to short UPC i.e keep short UPC as NULL.   Ex: If the Long UPC entered is *0002840000003* short upc becomes *284033* .