How to use validatePattern method in Karma

Best JavaScript code snippet using karma

refundStructure.js

Source:refundStructure.js Github

copy

Full Screen

...2852 }2853 if (iInv['Invoice Type'] != 'Regular' && (iInv['E-Commerce GSTIN'])) {2854 isPttnMthced = false;2855 } else {2856 isPttnMthced = (validatePattern(iInv['Invoice date'], true, null) &&2857 isValidDateFormat(iInv['Invoice date']) &&2858 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&2859 validatePattern(iInv['Place Of Supply'], true, null, true) &&2860 validatePattern(iInv['Invoice Type'], true, null) &&2861 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&2862 validatePattern(iInv['Reverse Charge'], true, /^(Y|N)$/) &&2863 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&2864 validateGSTIN(iInv['GSTIN/UIN of Recipient'], iForm) &&2865 validatePattern(iInv['GSTIN/UIN of Recipient'], true, null) &&2866 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&2867 validatePattern(iInv['Receiver Name'], false, /^[a-zA-Z0-9\_&'\-\.\/\,()?@!#%$~*;+= ]{1,99}$/) &&2868 (iInv['E-Commerce GSTIN'] == '' || iInv['E-Commerce GSTIN'] == null) &&2869 // validatePattern(iInv['E-Commerce GSTIN'], false, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[C]{1}[0-9a-zA-Z]{1}/) && 2870 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&2871 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)2872 );2873 }2874 break;2875 case 'b2ba':2876 if (!iInv['Reverse Charge']) {2877 iInv['Reverse Charge'] = 'N';2878 }2879 if (!iInv['Applicable % of Tax Rate']) {2880 iInv['Applicable % of Tax Rate'] = 100.00;2881 }2882 isPttnMthced = (validateGSTIN(iInv['GSTIN/UIN of Recipient'], iForm) &&2883 validatePattern(iInv['GSTIN/UIN of Recipient'], true, null) &&2884 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&2885 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&2886 validatePattern(iInv['Revised Invoice date'], true, null) &&2887 validatePattern(iInv['Original Invoice date'], true, null) &&2888 isValidDateFormat(iInv['Revised Invoice date']) &&2889 isValidDateFormat(iInv['Original Invoice date']) &&2890 validatePattern(iInv['Reverse Charge'], true, /^(Y|N)$/) &&2891 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&2892 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&2893 validatePattern(iInv['Place Of Supply'], true, null, true) &&2894 validatePattern(iInv['Invoice Type'], true, null) &&2895 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&2896 (iInv['E-Commerce GSTIN'] == '' || iInv['E-Commerce GSTIN'] == null) &&2897 /*validatePattern(iInv['E-Commerce GSTIN'], false, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[C]{1}[0-9a-zA-Z]{1}/) &&*/2898 validatePattern(iInv['Receiver Name'], false, /^[a-zA-Z0-9\_&'\-\.\/\,()?@!#%$~*;+= ]{1,99}$/) &&2899 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&2900 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)2901 );2902 break;2903 case 'b2cl':2904 if (!iInv['Applicable % of Tax Rate']) {2905 iInv['Applicable % of Tax Rate'] = 100.00;2906 }2907 isPttnMthced = ( /*validatePattern(iInv['Recipient Name'], true, /^[A-Za-z0-9. @]*$/) &&*/2908 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&2909 /*validatePattern(iInv['Recipient State Code'], true, null, true) &&*/2910 validatePattern(iInv['Place Of Supply'], true, null, true) &&2911 /*validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,}$/) &&*/2912 validatePattern(iInv['Invoice date'], true, null) &&2913 isValidDateFormat(iInv['Invoice date']) &&2914 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&2915 isValidTotalInvValue(iInv['Invoice Value']) &&2916 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&2917 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&2918 (iInv['E-Commerce GSTIN'] == '' || iInv['E-Commerce GSTIN'] == null) &&2919 // validatePattern(iInv['E-Commerce GSTIN'], false, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[C]{1}[0-9a-zA-Z]{1}/) &&2920 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&2921 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)2922 /*validatePattern(iInv['CGST Rate'], true, /^(0|2.5|6|9|14)$/) &&2923 validatePattern(iInv['SGST Rate'], true, /^(0|2.5|6|9|14)$/) &&2924 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&2925 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/)*/2926 );2927 break;2928 case 'b2cla':2929 if (!iInv['Applicable % of Tax Rate']) {2930 iInv['Applicable % of Tax Rate'] = 100.00;2931 }2932 isPttnMthced = ( /*validatePattern(iInv['Recipient Name'], true, /^[A-Za-z0-9. @]*$/) &&*/2933 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&2934 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&2935 /*validatePattern(iInv['Recipient State Code'], true, null, true) &&*/2936 validatePattern(iInv['Original Place Of Supply'], true, null, true) &&2937 /*validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,}$/) &&*/2938 validatePattern(iInv['Revised Invoice date'], true, null) &&2939 validatePattern(iInv['Original Invoice date'], true, null) &&2940 isValidDateFormat(iInv['Original Invoice date']) &&2941 isValidDateFormat(iInv['Revised Invoice date']) &&2942 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&2943 validatePattern(cnvt2Nm(iInv['Invoice Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&2944 isValidTotalInvValue(iInv['Invoice Value']) &&2945 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&2946 /*validatePattern(iInv['Category'], true, /^(G|S)$/) &&*/2947 /*validatePattern(iInv['Provisional Assessment'], true, /^(Y|N)$/) &&*/2948 (iInv['E-Commerce GSTIN'] == '' || iInv['E-Commerce GSTIN'] == null) &&2949 /*2950 validatePattern(iInv['E-Commerce GSTIN'], false, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[C]{1}[0-9a-zA-Z]{1}/) &&*/2951 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&2952 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)2953 );2954 break;2955 case 'b2cs':2956 if (!iInv['Applicable % of Tax Rate']) {2957 iInv['Applicable % of Tax Rate'] = 100.00;2958 }2959 var isRequired = (iInv['Type'] && iInv['Type'] == "E") ? true : false,2960 isERecord = false;2961 if (isRequired) {2962 isERecord = validatePattern(iInv['E-Commerce GSTIN'], isRequired, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[C]{1}[0-9a-zA-Z]{1}/);2963 }2964 else {2965 if (!(iInv['E-Commerce GSTIN'])) {2966 isERecord = true;2967 }2968 }2969 isPttnMthced = (2970 validatePattern(iInv['Place Of Supply'], true, null, true) &&2971 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,}$/) &&2972 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&2973 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&2974 validatePattern(iInv['Type'], true, /^(OE)$/) && isERecord &&2975 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&2976 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/)2977 );2978 break;2979 case 'b2csa':2980 if (!iInv['Applicable % of Tax Rate']) {2981 iInv['Applicable % of Tax Rate'] = 100.00;2982 }2983 var isRequired = (iInv['Type'] && iInv['Type'] == "E") ? true : false,2984 isERecord = false;2985 if (isRequired) {2986 isERecord = validatePattern(iInv['E-Commerce GSTIN'], isRequired, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[C]{1}[0-9a-zA-Z]{1}/);2987 }2988 else {2989 if (!(iInv['E-Commerce GSTIN'])) {2990 isERecord = true;2991 }2992 }2993 isPttnMthced = (2994 validatePattern(iInv['Financial Year'], true, yearPattern) &&2995 validatePattern(iInv['Original Month'], true, monthPattern) &&2996 validatePattern(iInv['Original Place Of Supply'], true, null, true) &&2997 validatePattern(iInv['Revised Place Of Supply'], true, null, true) &&2998 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,}$/) &&2999 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3000 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3001 validatePattern(iInv['Type'], true, /^(OE)$/) && isERecord &&3002 /*validatePattern(iInv['Type'], true, /^(E|OE)$/) && isERecord &&*/3003 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3004 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/)3005 );3006 break;3007 case 'cdnr':3008 if (!iInv['Applicable % of Tax Rate']) {3009 iInv['Applicable % of Tax Rate'] = 100.00;3010 }3011 if (!iInv['Pre GST']) {3012 iInv['Pre GST'] = 'N';3013 }3014 isPttnMthced = (validatePattern(iInv['Invoice/Advance Receipt date'], true, null) &&3015 isValidDateFormat(iInv['Invoice/Advance Receipt date']) &&3016 isValidDateFormat(iInv['Note/Refund Voucher date']) &&3017 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3018 // validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) &&3019 validatePattern(iInv['Document Type'], true, /^(C|D|R)$/) &&3020 validateGSTIN(iInv['GSTIN/UIN of Recipient'], iForm) &&3021 validatePattern(iInv['GSTIN/UIN of Recipient'], true, null) &&3022 // (validatePattern(iInv['GSTIN/UIN of Recipient'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Zz1-9A-Ja-j]{1}[0-9a-zA-Z]{1}/) ||3023 // validatePattern(iInv['GSTIN/UIN of Recipient'], true, /[0-9]{4}[A-Z]{3}[0-9]{5}[UO]{1}[N][A-Z0-9]{1}/)) &&3024 validatePattern(iInv['Invoice/Advance Receipt Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3025 validatePattern(iInv['Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3026 validatePattern(iInv['Note/Refund Voucher date'], true, null) &&3027 validatePattern(iInv['Place Of Supply'], true, null, true) &&3028 validatePattern(iInv['Note/Refund Voucher Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3029 // validatePattern(iInv['E-Commerce GSTIN'], false, /^[a-zA-Z0-9]{15}$/) &&3030 validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) &&3031 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3032 validatePattern(iInv['Receiver Name'], false, /^[a-zA-Z0-9\_&'\-\.\/\,()?@!#%$~*;+= ]{1,99}$/) &&3033 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3034 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3035 );3036 break;3037 case 'cdnur':3038 if (!iInv['Applicable % of Tax Rate']) {3039 iInv['Applicable % of Tax Rate'] = 100.00;3040 }3041 if (!iInv['Pre GST']) {3042 iInv['Pre GST'] = 'N';3043 }3044 var isRequired = false;3045 if ((iInv['UR Type'] == "EXPWOP") || (iInv['UR Type'] == "EXPWP")) {3046 if (!iInv['Place Of Supply'])3047 isRequired = true;3048 } else {3049 isRequired = validatePattern(iInv['Place Of Supply'], true, null, true)3050 }3051 isPttnMthced = (validatePattern(iInv['Invoice/Advance Receipt date'], true, null) &&3052 isValidDateFormat(iInv['Invoice/Advance Receipt date']) &&3053 isValidDateFormat(iInv['Note/Refund Voucher date']) &&3054 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3055 // validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) &&3056 validatePattern(iInv['Document Type'], true, /^(C|D|R)$/) &&3057 validatePattern(iInv['Invoice/Advance Receipt Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3058 validatePattern(iInv['Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3059 validatePattern(iInv['Note/Refund Voucher date'], true, null) &&3060 validatePattern(iInv['Note/Refund Voucher Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3061 validatePattern(iInv['UR Type'], true, /^(B2CL|EXPWP|EXPWOP|)$/) &&3062 isRequired &&3063 validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) &&3064 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3065 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3066 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3067 );3068 break;3069 case 'cdnra':3070 if (!iInv['Applicable % of Tax Rate']) {3071 iInv['Applicable % of Tax Rate'] = 100.00;3072 }3073 isPttnMthced = (validatePattern(iInv['Original Invoice/Advance Receipt Number'], true, null) &&3074 isValidDateFormat(iInv['Original Invoice/Advance Receipt date']) &&3075 isValidDateFormat(iInv['Original Note/Refund Voucher date']) &&3076 isValidDateFormat(iInv['Revised Note/Refund Voucher date']) &&3077 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3078 // validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) &&3079 validatePattern(iInv['Document Type'], true, /^(C|D|R)$/) &&3080 validateGSTIN(iInv['GSTIN/UIN of Recipient'], iForm) &&3081 validatePattern(iInv['GSTIN/UIN of Recipient'], true, null) &&3082 // (validatePattern(iInv['GSTIN/UIN of Recipient'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Zz1-9A-Ja-j]{1}[0-9a-zA-Z]{1}/) ||3083 // validatePattern(iInv['GSTIN/UIN of Recipient'], true, /[0-9]{4}[A-Z]{3}[0-9]{5}[UO]{1}[N][A-Z0-9]{1}/)) &&3084 validatePattern(iInv['Original Invoice/Advance Receipt Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3085 validatePattern(iInv['Original Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3086 validatePattern(iInv['Original Note/Refund Voucher date'], true, null) &&3087 validatePattern(iInv['Revised Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3088 validatePattern(iInv['Revised Note/Refund Voucher date'], true, null) &&3089 validatePattern(iInv['Supply Type'], true, /^(Inter State|Intra State)$/) &&3090 //validatePattern(iInv['Place Of Supply'], true, null, true) &&3091 validatePattern(cnvt2Nm(iInv['Note/Refund Voucher Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3092 // validatePattern(iInv['E-Commerce GSTIN'], false, /^[a-zA-Z0-9]{15}$/) &&3093 validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) &&3094 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3095 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3096 validatePattern(iInv['Receiver Name'], false, /^[a-zA-Z0-9\_&'\-\.\/\,()?@!#%$~*;+= ]{1,99}$/) &&3097 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3098 );3099 break;3100 case 'cdnura':3101 if (!iInv['Applicable % of Tax Rate']) {3102 iInv['Applicable % of Tax Rate'] = 100.00;3103 }3104 if (!iInv['Pre GST']) {3105 iInv['Pre GST'] = 'N';3106 }3107 var isRequired = false;3108 /*if ((iInv['UR Type'] == "EXPWOP") || (iInv['UR Type'] == "EXPWP")) {3109 if (!iInv['Place Of Supply'])3110 isRequired = true;3111 } else {3112 isRequired = validatePattern(iInv['Place Of Supply'], true, null, true)3113 }*/3114 isPttnMthced = (validatePattern(iInv['Original Invoice/Advance Receipt date'], true, null) &&3115 isValidDateFormat(iInv['Original Invoice/Advance Receipt date']) &&3116 isValidDateFormat(iInv['Original Note/Refund Voucher date']) &&3117 isValidDateFormat(iInv['Revised Note/Refund Voucher date']) &&3118 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3119 // validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) &&3120 validatePattern(iInv['Document Type'], true, /^(C|D|R)$/) &&3121 validatePattern(iInv['Original Invoice/Advance Receipt Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3122 validatePattern(iInv['Original Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3123 validatePattern(iInv['Original Note/Refund Voucher date'], true, null) &&3124 validatePattern(iInv['Revised Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3125 validatePattern(iInv['Revised Note/Refund Voucher date'], true, null) &&3126 validatePattern(cnvt2Nm(iInv['Note/Refund Voucher Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3127 validatePattern(iInv['UR Type'], true, /^(B2CL|EXPWP|EXPWOP|)$/) &&3128 validatePattern(iInv['Supply Type'], true, /^(Inter State)$/) &&3129 //isRequired &&3130 validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) &&3131 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3132 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3133 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3134 );3135 break;3136 case 'exp':3137 if (!iInv['Applicable % of Tax Rate']) {3138 iInv['Applicable % of Tax Rate'] = 100.00;3139 }3140 if (iInv['Shipping Bill Number'] || iInv['Shipping Bill Date']) {3141 isPttnMthced = (validatePattern(iInv['Invoice date'], true, null) &&3142 isValidDateFormat(iInv['Invoice date']) &&3143 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3144 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3145 validatePattern(iInv['Export Type'], true, /^(WPAY|WOPAY)$/) &&3146 validatePattern(iInv['Shipping Bill Number'], true, /^[0-9]{0,7}$/) &&3147 validatePattern(iInv['Shipping Bill Date'], true, null) &&3148 isValidDateFormat(iInv['Shipping Bill Date']) &&3149 validatePattern(iInv['Port Code'], false, null) &&3150 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3151 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3152 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3153 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3154 );3155 }3156 else {3157 isPttnMthced = (validatePattern(iInv['Invoice date'], true, null) &&3158 isValidDateFormat(iInv['Invoice date']) &&3159 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3160 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3161 validatePattern(iInv['Export Type'], true, /^(WPAY|WOPAY)$/) &&3162 validatePattern(iInv['Shipping Bill Number'], false, /^[0-9]{0,7}$/) &&3163 validatePattern(iInv['Shipping Bill Date'], false, null) &&3164 validatePattern(iInv['Port Code'], false, null) &&3165 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3166 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3167 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3168 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3169 );3170 }3171 break;3172 case 'expa':3173 if (!iInv['Applicable % of Tax Rate']) {3174 iInv['Applicable % of Tax Rate'] = 100.00;3175 }3176 if (iInv['Shipping Bill Number'] || iInv['Shipping Bill Date']) {3177 isPttnMthced = (validatePattern(iInv['Original Invoice date'], true, null) &&3178 isValidDateFormat(iInv['Original Invoice date']) &&3179 validatePattern(iInv['Revised Invoice date'], true, null) &&3180 isValidDateFormat(iInv['Revised Invoice date']) &&3181 validatePattern(cnvt2Nm(iInv['Invoice Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3182 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3183 validatePattern(iInv['Export Type'], true, /^(WPAY|WOPAY)$/) &&3184 validatePattern(iInv['Shipping Bill Number'], true, /^[0-9]{0,7}$/) &&3185 validatePattern(iInv['Shipping Bill Date'], true, null) &&3186 isValidDateFormat(iInv['Shipping Bill Date']) &&3187 validatePattern(iInv['Port Code'], false, null) &&3188 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3189 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3190 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3191 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3192 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3193 );3194 }3195 else {3196 isPttnMthced = (validatePattern(iInv['Original Invoice date'], true, null) &&3197 isValidDateFormat(iInv['Original Invoice date']) &&3198 validatePattern(iInv['Revised Invoice date'], true, null) &&3199 isValidDateFormat(iInv['Revised Invoice date']) &&3200 validatePattern(cnvt2Nm(iInv['Invoice Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3201 validatePattern(cnvt2Nm(iInv['Taxable Value']), true, /^(\d{0,13})(\.\d{0,2})?$/) &&3202 validatePattern(iInv['Export Type'], true, /^(WPAY|WOPAY)$/) &&3203 validatePattern(iInv['Shipping Bill Number'], false, /^[0-9]{0,7}$/) &&3204 validatePattern(iInv['Shipping Bill Date'], false, null) &&3205 validatePattern(iInv['Port Code'], false, null) &&3206 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3207 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3208 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3209 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3210 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3211 );3212 }3213 break;3214 case 'at':3215 if (!iInv['Applicable % of Tax Rate']) {3216 iInv['Applicable % of Tax Rate'] = 100.00;3217 }3218 isPttnMthced = (3219 validatePattern(iInv['Place Of Supply'], true, null, true) &&3220 validatePattern(iInv['Gross Advance Received'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3221 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3222 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3223 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3224 );3225 break;3226 case 'ata':3227 /*isPttnMthced = (3228 validatePattern(iInv['Recipient State Code'], true, null, true) &&3229 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,}$/) &&3230 validatePattern(iInv['Total Taxable Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3231 validatePattern(iInv['Category'], true, /^(G|S)$/) &&3232 validatePattern(iInv['Original Document Number'], true, /^[a-zA-Z0-9]*$/) &&3233 validatePattern(iInv['Original Document date'], true, null) &&3234 isValidDateFormat(iInv['Original Document date']) &&3235 isValidDateFormat(iInv['Revised Document date']) &&3236 validatePattern(iInv['Revised Document Number'], true, /^[a-zA-Z0-9]*$/) &&3237 validatePattern(iInv['Revised Document date'], true, null) &&3238 validatePattern(iInv['Total Invoice Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3239 validatePattern(iInv['Original Customer GSTIN/UIN/Name'], true, /^[a-zA-Z0-9]{15}$/) &&3240 validatePattern(iInv['Revised Customer GSTIN/UIN/Name'], true, /^[a-zA-Z0-9]{15}$/) &&3241 validatePattern(iInv['CGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3242 validatePattern(iInv['SGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3243 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3244 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/)3245 );*/3246 if (!iInv['Applicable % of Tax Rate']) {3247 iInv['Applicable % of Tax Rate'] = 100.00;3248 }3249 isPttnMthced = (3250 validatePattern(iInv['Financial Year'], true, yearPattern) &&3251 validatePattern(iInv['Original Month'], true, monthPattern) &&3252 validatePattern(iInv['Original Place Of Supply'], true, null, true) &&3253 validatePattern(iInv['Gross Advance Received'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3254 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3255 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3256 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3257 );3258 break;3259 case 'atadj':3260 if (!iInv['Applicable % of Tax Rate']) {3261 iInv['Applicable % of Tax Rate'] = 100.00;3262 }3263 isPttnMthced = (3264 validatePattern(iInv['Place Of Supply'], true, null, true) &&3265 validatePattern(iInv['Gross Advance Adjusted'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3266 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3267 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3268 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3269 );3270 break;3271 case 'atadja':3272 if (!iInv['Applicable % of Tax Rate']) {3273 iInv['Applicable % of Tax Rate'] = 100.00;3274 }3275 isPttnMthced = (3276 validatePattern(iInv['Financial Year'], true, yearPattern) &&3277 validatePattern(iInv['Original Month'], true, monthPattern) &&3278 validatePattern(iInv['Original Place Of Supply'], true, null, true) &&3279 validatePattern(iInv['Gross Advance Adjusted'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3280 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3281 validatePattern(iInv['Applicable % of Tax Rate'], true, /^(100|65)$/) &&3282 validatePattern(cnvt2Nm(iInv['Cess Amount']), false, /^(\d{0,13})(\.\d{0,2})?$/)3283 );3284 break;3285 case 'hsn':3286 var isHSNReq = true, isDescrReq = true;3287 var isITAmt = true, isSTUTAmt = true, isCTAmt = true;3288 if (iInv['Integrated Tax Amount']) {3289 isSTUTAmt = false; isCTAmt = false;3290 } else if (iInv['Central Tax Amount'] && iInv['State/UT Tax Amount']) {3291 isITAmt = false;3292 }3293 if (iInv['HSN']) {3294 isDescrReq = false;3295 }3296 else if (iInv['Description']) {3297 isHSNReq = false;3298 }3299 if (iInv['UQC'])3300 iInv['UQC'] = (iInv['UQC']).trim();3301 isPttnMthced = (3302 validatePattern(iInv['HSN'], isHSNReq, /^[0-9]{2,8}$/) &&3303 validatePattern(iInv['Description'], isDescrReq, /^[ A-Za-z0-9_@./&-]{0,30}$/) &&3304 validatePattern(iInv['UQC'], true, /^[a-zA-Z -]*$/) &&3305 validatePattern(Math.abs(cnvt2Nm(iInv['Total Quantity'])), true, /^(\-?(\d{0,15})(\.\d{0,2})?)$/) && // &&3306 validatePattern(Math.abs(cnvt2Nm(iInv['Total Value'])), true, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3307 validatePattern(Math.abs(cnvt2Nm(iInv['Taxable Value'])), true, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3308 validatePattern(Math.abs(cnvt2Nm(iInv['Integrated Tax Amount'])), isITAmt, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3309 validatePattern(Math.abs(cnvt2Nm(iInv['Central Tax Amount'])), isCTAmt, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3310 validatePattern(Math.abs(cnvt2Nm(iInv['State/UT Tax Amount'])), isSTUTAmt, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3311 validatePattern(Math.abs(cnvt2Nm(iInv['Cess Amount'])), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/)3312 );3313 break;3314 case 'nil':3315 isPttnMthced = (3316 validatePattern(cnvt2Nm(iInv['Nil Rated Supplies']), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3317 validatePattern(cnvt2Nm(iInv['Exempted(other than nil rated/non GST supply)']), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3318 validatePattern(cnvt2Nm(iInv['Non-GST Supplies']), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3319 (3320 iInv['Description'] == 'Inter-State supplies to registered persons' ||3321 iInv['Description'] == 'Intra-State supplies to registered persons' ||3322 iInv['Description'] == 'Inter-State supplies to unregistered persons' ||3323 iInv['Description'] == 'Intra-State supplies to unregistered persons'3324 )3325 );3326 break;3327 case 'doc_issue':3328 isPttnMthced = (validatePattern(iInv['Sr. No. From'], true, /^[a-zA-Z0-9\/\-]{1,16}$/) &&3329 validatePattern(iInv['Sr. No. To'], true, /^[a-zA-Z0-9\/\-]{1,16}$/) &&3330 validatePattern(iInv['Total Number'], true, /^(\d*)$/) &&3331 validatePattern(iInv['Cancelled'], true, /^(\d*)$/) &&3332 (cnvt2Nm(iInv['Total Number']) >= cnvt2Nm(iInv['Cancelled'])) &&3333 validatePattern(iInv['Nature of Document'], true, /^(Invoices for outward supply|Invoices for inward supply from unregistered person|Revised Invoice|Debit Note|Credit Note|Receipt Voucher|Payment Voucher|Refund Voucher|Delivery Challan for job work|Delivery Challan for supply on approval|Delivery Challan in case of liquid gas|Delivery Challan in case other than by way of supply (excluding at S no. 9 to 11))$/));3334 break;3335 }3336 } else if (iForm == "GSTR2") {3337 switch (iSecId) {3338 case 'b2b': // GSTR23339 if (!iInv['Reverse Charge']) {3340 iInv['Reverse Charge'] = 'N';3341 }3342 if (!iInv['Integrated Tax Paid'])3343 iInv['Integrated Tax Paid'] = 0;3344 if (!iInv['Central Tax Paid'])3345 iInv['Central Tax Paid'] = 0;3346 if (!iInv['State/UT Tax Paid'])3347 iInv['State/UT Tax Paid'] = 0;3348 isPttnMthced = (validatePattern(iInv['Invoice date'], true, null) &&3349 isValidDateFormat(iInv['Invoice date']) &&3350 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3351 validatePattern(iInv['Place Of Supply'], true, null, true) &&3352 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3353 validatePattern(iInv['Integrated Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3354 validatePattern(iInv['Central Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3355 validatePattern(iInv['State/UT Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3356 validatePattern(iInv['Availed ITC Integrated Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3357 validatePattern(iInv['Availed ITC Central Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3358 validatePattern(iInv['Availed ITC State/UT Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3359 validatePattern(iInv['Availed ITC Cess'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3360 (cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) &&3361 (cnvt2Nm(iInv['Availed ITC Central Tax']) <= cnvt2Nm(iInv['Central Tax Paid'])) &&3362 (cnvt2Nm(iInv['Availed ITC State/UT Tax']) <= cnvt2Nm(iInv['State/UT Tax Paid'])) &&3363 (cnvt2Nm(iInv['Availed ITC Cess']) <= cnvt2Nm(iInv['Cess Paid'])) &&3364 validatePattern(iInv['Reverse Charge'], true, /^(Y|N)$/) &&3365 validateGSTIN(iInv['GSTIN of Supplier'], iForm) &&3366 validatePattern(iInv['GSTIN of Supplier'], true, null) &&3367 validatePattern(iInv['Supplier Name'], false, null) &&3368 // validatePattern(iInv['GSTIN of Supplier'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3369 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3370 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3371 validatePattern(iInv['Eligibility For ITC'], true, /^(Inputs|Input services|Capital goods|Ineligible)$/) && isEligibleForITC(iInv['Place Of Supply'], iInv['Eligibility For ITC'])3372 );3373 break;3374 case 'b2bur': // GSTR23375 isPttnMthced = (3376 validatePattern(iInv['Invoice date'], true, null) &&3377 isValidDateFormat(iInv['Invoice date']) &&3378 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3379 validatePattern(iInv['Place Of Supply'], true, null, true) &&3380 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3381 validatePattern(iInv['Supplier Name'], false, /^[a-zA-Z0-9\_&'\-\.\/\,()?@!#%$~*;+= ]{1,99}$/) &&3382 validatePattern(iInv['Integrated Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3383 validatePattern(iInv['Central Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3384 validatePattern(iInv['State/UT Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3385 validatePattern(iInv['Availed ITC Integrated Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3386 validatePattern(iInv['Availed ITC Central Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3387 validatePattern(iInv['Availed ITC State/UT Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3388 validatePattern(iInv['Availed ITC Cess'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3389 (cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) &&3390 (cnvt2Nm(iInv['Availed ITC Central Tax']) <= cnvt2Nm(iInv['Central Tax Paid'])) &&3391 (cnvt2Nm(iInv['Availed ITC State/UT Tax']) <= cnvt2Nm(iInv['State/UT Tax Paid'])) &&3392 (cnvt2Nm(iInv['Availed ITC Cess']) <= cnvt2Nm(iInv['Cess Paid'])) &&3393 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3394 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3395 validatePattern(iInv['Eligibility For ITC'], true, /^(Inputs|Input services|Capital goods|Ineligible)$/) &&3396 /*validatePattern(iInv['Supply Type'], true, /^(Inter State|Intra State)$/)*/3397 validatePattern(iInv['Supply Type'].trim(), true, /^(Inter State|Intra State)$/) && isEligibleForITC(iInv['Place Of Supply'], iInv['Eligibility For ITC'])3398 );3399 break;3400 case 'b2ba': // GSTR23401 if (!iInv['Reverse Charge']) {3402 iInv['Reverse Charge'] = 'N';3403 }3404 isPttnMthced = (validatePattern(iInv['Original Invoice date'], true, null) &&3405 validatePattern(iInv['Revised Invoice date'], true, null) &&3406 isValidDateFormat(iInv['Original Invoice date']) &&3407 isValidDateFormat(iInv['Revised Invoice date']) &&3408 validatePattern(iInv['Total Invoice Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3409 validatePattern(iInv['Place Of Supply'], true, null, true) &&3410 validatePattern(iInv['Total Taxable Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3411 validatePattern(iInv['Category'], true, /^(G|S)$/) &&3412 validatePattern(iInv['Reverse Charge'], true, /^(Y|N)$/) &&3413 validatePattern(iInv['Supplier GSTIN'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3414 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3415 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3416 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,8}$/) &&3417 validatePattern(iInv['CGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3418 validatePattern(iInv['SGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3419 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3420 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/) &&3421 validateItcValues(iInv['IGST Amount'], iInv['Taxable IGST']) &&3422 validateItcValues(iInv['CGST Amount'], iInv['Taxable CGST']) &&3423 validateItcValues(iInv['SGST Amount'], iInv['Taxable SGST']) &&3424 validateItcValues(iInv['Cess Amount'], iInv['Taxable CESS']) &&3425 validateItcValues(iInv['Taxable IGST'], iInv['ITC IGST']) &&3426 validateItcValues(iInv['Taxable SGST'], iInv['ITC SGST']) &&3427 validateItcValues(iInv['Taxable CGST'], iInv['ITC CGST']) &&3428 validateItcValues(iInv['Taxable CESS'], iInv['ITC CESS'])3429 );3430 break;3431 case 'b2bura': // GSTR23432 if (!iInv['Reverse Charge']) {3433 iInv['Reverse Charge'] = 'N';3434 }3435 isPttnMthced = (validatePattern(iInv['Original Invoice date'], true, null) &&3436 validatePattern(iInv['Revised Invoice date'], true, null) &&3437 isValidDateFormat(iInv['Original Invoice date']) &&3438 isValidDateFormat(iInv['Revised Invoice date']) &&3439 validatePattern(iInv['Total Invoice Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3440 validatePattern(iInv['Place Of Supply'], true, null, true) &&3441 validatePattern(iInv['Total Taxable Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3442 validatePattern(iInv['Category'], true, /^(G|S)$/) &&3443 validatePattern(iInv['Reverse Charge'], true, /^(Y|N)$/) &&3444 validatePattern(iInv['Supplier Name'], true, /[A-Za-z0-9_@\s]{50}/) &&3445 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3446 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3447 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,8}$/) &&3448 validatePattern(iInv['CGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3449 validatePattern(iInv['SGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3450 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3451 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/) &&3452 validateItcValues(iInv['IGST Amount'], iInv['Taxable IGST']) &&3453 validateItcValues(iInv['CGST Amount'], iInv['Taxable CGST']) &&3454 validateItcValues(iInv['SGST Amount'], iInv['Taxable SGST']) &&3455 validateItcValues(iInv['Cess Amount'], iInv['Taxable CESS']) &&3456 validateItcValues(iInv['Taxable IGST'], iInv['ITC IGST']) &&3457 validateItcValues(iInv['Taxable SGST'], iInv['ITC SGST']) &&3458 validateItcValues(iInv['Taxable CGST'], iInv['ITC CGST']) &&3459 validateItcValues(iInv['Taxable CESS'], iInv['ITC CESS'])3460 );3461 break;3462 case 'cdnr': // GSTR23463 if (!iInv['Pre GST']) {3464 iInv['Pre GST'] = 'N';3465 }3466 isPttnMthced = (validatePattern(iInv['Invoice/Advance Payment Voucher date'], true, null) &&3467 isValidDateFormat(iInv['Invoice/Advance Payment Voucher date']) &&3468 validateGSTIN(iInv['GSTIN of Supplier'], iForm) &&3469 validatePattern(iInv['GSTIN of Supplier'], true, null) &&3470 validatePattern(iInv['Supplier Name'], false, null) &&3471 // validatePattern(iInv['GSTIN of Supplier'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3472 isValidDateFormat(iInv['Note/Refund Voucher date']) &&3473 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3474 validatePattern(iInv['Note/Refund Voucher Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3475 validatePattern(iInv['Integrated Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3476 validatePattern(iInv['Central Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3477 validatePattern(iInv['State/UT Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3478 validatePattern(iInv['Availed ITC Integrated Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3479 validatePattern(iInv['Availed ITC Central Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3480 validatePattern(iInv['Availed ITC State/UT Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3481 validatePattern(iInv['Availed ITC Cess'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3482 (cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) &&3483 (cnvt2Nm(iInv['Availed ITC Central Tax']) <= cnvt2Nm(iInv['Central Tax Paid'])) &&3484 (cnvt2Nm(iInv['Availed ITC State/UT Tax']) <= cnvt2Nm(iInv['State/UT Tax Paid'])) &&3485 (cnvt2Nm(iInv['Availed ITC Cess']) <= cnvt2Nm(iInv['Cess Paid'])) &&3486 validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) &&3487 validatePattern(iInv['Document Type'], true, /^(C|D)$/) &&3488 validatePattern(iInv['Invoice/Advance Payment Voucher Number'], true, /^[a-zA-Z0-9-\/]*$/) &&3489 validatePattern(iInv['Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]*$/) &&3490 validatePattern(iInv['Note/Refund Voucher date'], true, null) &&3491 validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) &&3492 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3493 validatePattern(iInv['Supply Type'], true, /^(Inter State|Intra State)$/)3494 );3495 // if(iInv['Note/Refund Voucher Number'] == "12345"){3496 // console.log("cdnr starts here");3497 // console.log(validatePattern(iInv['Invoice/Advance Payment Voucher date'], true, null) );3498 // console.log(isValidDateFormat(iInv['Invoice/Advance Payment Voucher date']) );3499 // console.log(validateGSTIN(iInv['GSTIN of Supplier'], iForm) );3500 // console.log(validatePattern(iInv['GSTIN of Supplier'], true, null) );3501 // // validatePattern(iInv['GSTIN of Supplier'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3502 // console.log(isValidDateFormat(iInv['Note/Refund Voucher date']) );3503 // console.log(validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) );3504 // console.log(validatePattern(iInv['Integrated Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3505 // console.log(validatePattern(iInv['Central Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3506 // console.log(validatePattern(iInv['State/UT Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3507 // console.log(validatePattern(iInv['Availed ITC Integrated Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3508 // console.log(validatePattern(iInv['Availed ITC Central Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3509 // console.log(validatePattern(iInv['Availed ITC State/UT Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3510 // console.log(validatePattern(iInv['Availed ITC Cess'], false, /^(\d{0,13})(\.\d{0,2})?$/) );3511 // console.log((cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) );3512 // console.log((cnvt2Nm(iInv['Availed ITC Central Tax']) <= cnvt2Nm(iInv['Central Tax Paid'])) );3513 // console.log((cnvt2Nm(iInv['Availed ITC State/UT Tax']) <= cnvt2Nm(iInv['State/UT Tax Paid'])) );3514 // console.log((cnvt2Nm(iInv['Availed ITC Cess']) <= cnvt2Nm(iInv['Cess Paid'])) );3515 // console.log(validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) );3516 // console.log(validatePattern(iInv['Document Type'], true, /^(C|D)$/) );3517 // console.log(validatePattern(iInv['Invoice/Advance Payment Voucher Number'], true, /^[a-zA-Z0-9-\/]*$/) );3518 // console.log(validatePattern(iInv['Note/Refund Voucher Number'], true, /^[a-zA-Z0-9-\/]*$/) );3519 // console.log(validatePattern(iInv['Note/Refund Voucher date'], true, null) );3520 // console.log(validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) );3521 // console.log(validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) );3522 // console.log(validatePattern(iInv['Supply Type'], true, /^(Inter State|Intra State)$/));3523 // }3524 break;3525 case 'cdnur': // GSTR23526 if (!iInv['Pre GST']) {3527 iInv['Pre GST'] = 'N';3528 }3529 isPttnMthced = (validatePattern(iInv['Invoice/Advance Payment Voucher date'], true, null) &&3530 isValidDateFormat(iInv['Invoice/Advance Payment Voucher date']) &&3531 isValidDateFormat(iInv['Note/Voucher date']) &&3532 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3533 validatePattern(iInv['Note/Voucher Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3534 validatePattern(iInv['Integrated Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3535 validatePattern(iInv['Central Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3536 validatePattern(iInv['State/UT Tax Paid'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3537 validatePattern(iInv['Availed ITC Integrated Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3538 validatePattern(iInv['Availed ITC Central Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3539 validatePattern(iInv['Availed ITC State/UT Tax'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3540 validatePattern(iInv['Availed ITC Cess'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3541 (cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) &&3542 (cnvt2Nm(iInv['Availed ITC Central Tax']) <= cnvt2Nm(iInv['Central Tax Paid'])) &&3543 (cnvt2Nm(iInv['Availed ITC State/UT Tax']) <= cnvt2Nm(iInv['State/UT Tax Paid'])) &&3544 (cnvt2Nm(iInv['Availed ITC Cess']) <= cnvt2Nm(iInv['Cess Paid'])) &&3545 validatePattern(iInv['Reason For Issuing document'], true, /^(01-Sales Return|02-Post Sale Discount|03-Deficiency in services|04-Correction in Invoice|05-Change in POS|06-Finalization of Provisional assessment|07-Others)$/) &&3546 validatePattern(iInv['Document Type'], true, /^(C|D|R)$/) &&3547 validatePattern(iInv['Invoice/Advance Payment Voucher number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3548 validatePattern(iInv['Note/Voucher Number'], true, /^[a-zA-Z0-9-\/]{1,16}$/) &&3549 validatePattern(iInv['Note/Voucher date'], true, null) &&3550 // isRequired &&3551 validatePattern(iInv['Pre GST'], true, /^(Y|N)$/) &&3552 validatePattern(iInv['Invoice Type'], true, /^(B2BUR|IMPS)$/) &&3553 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3554 validatePattern(iInv['Supply Type'].trim(), true, /^(Inter State|Intra State)$/) &&3555 isValidSuplyType(iInv['Invoice Type'], iInv['Supply Type'].trim())3556 );3557 break;3558 case 'cdnra': // GSTR23559 isPttnMthced = (validatePattern(iInv['Invoice date'], true, null) &&3560 isValidDateFormat(iInv['Invoice date']) &&3561 isValidDateFormat(iInv['Original Debit Note date']) &&3562 isValidDateFormat(iInv['Revised Debit Note date']) &&3563 validatePattern(iInv['Total Differential Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3564 validatePattern(iInv['Reason For Issuing Note'], true, /^(Balance|Sales Return|Post Sale Discount|Deficiency in Service|Not mentioned|Others)$/) &&3565 validatePattern(iInv['Note Type'], true, /^(C|D)$/) &&3566 validatePattern(iInv['Supplier GSTIN'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3567 validatePattern(iInv['Invoice Number'], true, /^[a-zA-Z0-9]*$/) &&3568 validatePattern(iInv['Original Debit Note Number'], true, /^[a-zA-Z0-9]*$/) &&3569 validatePattern(iInv['Original Debit Note date'], true, null) &&3570 validatePattern(iInv['Revised Debit Note Number'], true, /^[a-zA-Z0-9]*$/) &&3571 validatePattern(iInv['Revised Debit Note date'], true, null) &&3572 validatePattern(iInv['E-Commerce GSTIN'], false, /^[a-zA-Z0-9]{15}$/) &&3573 validatePattern(iInv['CGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3574 validatePattern(iInv['SGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3575 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3576 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/) &&3577 validateItcValues(iInv['IGST Amount'], iInv['Taxable IGST']) &&3578 validateItcValues(iInv['CGST Amount'], iInv['Taxable CGST']) &&3579 validateItcValues(iInv['SGST Amount'], iInv['Taxable SGST']) &&3580 validateItcValues(iInv['Cess Amount'], iInv['Taxable CESS']) &&3581 validateItcValues(iInv['Taxable IGST'], iInv['ITC IGST']) &&3582 validateItcValues(iInv['Taxable SGST'], iInv['ITC SGST']) &&3583 validateItcValues(iInv['Taxable CGST'], iInv['ITC CGST']) &&3584 validateItcValues(iInv['Taxable CESS'], iInv['ITC CESS'])3585 );3586 break;3587 case 'imp_g': // GSTR23588 if (!iInv['GSTIN Of SEZ Supplier']) {3589 iInv['GSTIN Of SEZ Supplier'] = '';3590 }3591 var validGstn, isRequired;3592 if (iInv['Document Type'] == 'Received from SEZ') {3593 validGstn = validateGSTIN(iInv['GSTIN Of SEZ Supplier'], iForm),3594 isRequired = true;3595 }3596 else {3597 validGstn = true;3598 isRequired = false;3599 }3600 isPttnMthced = (3601 // validatePattern(iInv['GSTIN Of SEZ Supplier'], false, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3602 validGstn &&3603 validatePattern(iInv['GSTIN Of SEZ Supplier'], isRequired, null) &&3604 validatePattern(iInv['Bill Of Entry Date'], true, null) &&3605 isValidDateFormat(iInv['Bill Of Entry Date']) &&3606 validatePattern(iInv['Bill Of Entry Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) && validatePattern(iInv['Document type'], true, /^(Imports|Received from SEZ)$/) &&3607 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3608 //validatePattern(iInv['Category'], true, /^(G|S)$/) &&3609 validatePattern(iInv['Port Code'], true, /^[a-zA-Z0-9-\/]{6}$/) &&3610 validatePattern(iInv['Bill Of Entry Number'], true, /^[0-9]{7}$/) &&3611 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3612 validatePattern(iInv['Eligibility For ITC'], true, /^(Inputs|Input services|Capital goods|Ineligible)$/) &&3613 (cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) && isImportFromSez(iInv['GSTIN Of SEZ Supplier'], iInv['Document type'])3614 );3615 break;3616 case 'imp_ga': // GSTR23617 isPttnMthced = (validatePattern(iInv['Original Bill Of Entry date'], true, null) &&3618 isValidDateFormat(iInv['Original Bill Of Entry date']) &&3619 validatePattern(iInv['Revised Bill Of Entry date'], true, null) &&3620 isValidDateFormat(iInv['Revised Bill Of Entry date']) &&3621 validatePattern(iInv['Total Invoice Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3622 validatePattern(iInv['Total Taxable Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3623 validatePattern(iInv['Category'], true, /^(G|S)$/) &&3624 validatePattern(iInv['Port Code'], false, /^[a-zA-Z0-9]*$/) &&3625 validatePattern(iInv['Original Bill Of Entry Number'], true, /^[a-zA-Z0-9-/]*$/) &&3626 validatePattern(iInv['Revised Bill Of Entry Number'], true, /^[a-zA-Z0-9-/]*$/) &&3627 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,8}$/) &&3628 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3629 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/) &&3630 validateItcValues(iInv['IGST Amount'], iInv['Taxable IGST']) &&3631 validateItcValues(iInv['Cess Amount'], iInv['Taxable CESS']) &&3632 validateItcValues(iInv['Taxable IGST'], iInv['ITC IGST']) &&3633 validateItcValues(iInv['Taxable CESS'], iInv['ITC CESS'])3634 );3635 break;3636 case 'imp_s': // GSTR23637 isPttnMthced = ((validatePattern(iInv['Invoice date'], true, null) || validatePattern(iInv['Invoice Date'], true, null)) &&3638 (isValidDateFormat(iInv['Invoice date']) || isValidDateFormat(iInv['Invoice Date'])) &&3639 validatePattern(iInv['Invoice Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3640 validatePattern(iInv['Taxable Value'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3641 validatePattern(iInv['Place Of Supply'], true, null, true) &&3642 validatePattern(iInv['Invoice Number of Reg Recipient'], true, /^[a-zA-Z0-9-/]*$/) &&3643 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3644 validatePattern(iInv['Eligibility For ITC'], true, /^(Inputs|Input services|Capital goods|Ineligible)$/) &&3645 (cnvt2Nm(iInv['Availed ITC Integrated Tax']) <= cnvt2Nm(iInv['Integrated Tax Paid'])) && isEligibleForITC(iInv['Place Of Supply'], iInv['Eligibility For ITC'])3646 );3647 break;3648 case 'imp_sa': // GSTR23649 isPttnMthced = (validatePattern(iInv['Original Invoice date'], true, null) &&3650 isValidDateFormat(iInv['Original Invoice date']) &&3651 validatePattern(iInv['Revised Invoice date'], true, null) &&3652 isValidDateFormat(iInv['Revised Invoice date']) &&3653 validatePattern(iInv['Total Invoice Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3654 validatePattern(iInv['Total Taxable Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3655 validatePattern(iInv['Category'], true, /^(G|S)$/) &&3656 validatePattern(iInv['Port Code'], false, /^[a-zA-Z0-9]*$/) &&3657 validatePattern(iInv['Original Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3658 validatePattern(iInv['Revised Invoice Number'], true, /^[a-zA-Z0-9-/]*$/) &&3659 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,8}$/) &&3660 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3661 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/) &&3662 validateItcValues(iInv['IGST Amount'], iInv['Taxable IGST']) &&3663 validateItcValues(iInv['Cess Amount'], iInv['Taxable CESS']) &&3664 validateItcValues(iInv['Taxable IGST'], iInv['ITC IGST']) &&3665 validateItcValues(iInv['Taxable CESS'], iInv['ITC CESS'])3666 );3667 break;3668 case 'txi': // GSTR23669 isPttnMthced = (3670 validatePattern(iInv['Place Of Supply'], true, null, true) &&3671 validatePattern(iInv['Gross Advance Paid'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3672 validatePattern(iInv['Supply Type'], true, /^(Inter State|Intra State)$/)3673 );3674 break;3675 case 'atxi': // GSTR23676 isPttnMthced = (3677 validatePattern(iInv['Recipient State Code'], true, null, true) &&3678 // validatePattern(iInv['HSN/SAC of Supply'], false, /^[0-9]{2,}$/) &&3679 validatePattern(iInv['Total Taxable Value'], true, /^((\d*)|(\d*.\d{0,2}))$/) &&3680 validatePattern(iInv['Category'], true, /^(G|S)$/) &&3681 validatePattern(iInv['Type'], true, /^(REGD|UNREGD)$/) &&3682 validatePattern(iInv['Original Document Number'], true, /^[a-zA-Z0-9]*$/) &&3683 validatePattern(iInv['Original Document date'], true, null) &&3684 validatePattern(iInv['Revised Document Number'], true, /^[a-zA-Z0-9]*$/) &&3685 validatePattern(iInv['Revised Document date'], true, null) &&3686 isValidDateFormat(iInv['Original Document date']) &&3687 isValidDateFormat(iInv['Revised Document date']) &&3688 validatePattern(iInv['Original Supplier GSTIN'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3689 validatePattern(iInv['Revised Supplier GSTIN'], true, /[0-9]{2}[a-zA-Z]{5}[0-9]{4}[a-zA-Z]{1}[1-9A-Za-z]{1}[Z]{1}[0-9a-zA-Z]{1}/) &&3690 validatePattern(iInv['CGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3691 validatePattern(iInv['SGST Rate'], true, /^(0|2.5|6|9|14)$/) &&3692 validatePattern(iInv['IGST Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3693 validatePattern(iInv['CESS Rate'], false, /^(0|15|135|290)$/) &&3694 validateItcValues(iInv['IGST Amount'], iInv['Taxable IGST']) &&3695 validateItcValues(iInv['CGST Amount'], iInv['Taxable CGST']) &&3696 validateItcValues(iInv['SGST Amount'], iInv['Taxable SGST']) &&3697 validateItcValues(iInv['Cess Amount'], iInv['Taxable CESS']) &&3698 validateItcValues(iInv['Taxable IGST'], iInv['ITC IGST']) &&3699 validateItcValues(iInv['Taxable SGST'], iInv['ITC SGST']) &&3700 validateItcValues(iInv['Taxable CGST'], iInv['ITC CGST']) &&3701 validateItcValues(iInv['Taxable CESS'], iInv['ITC CESS'])3702 );3703 break;3704 case 'hsnsum': // GSTR23705 var isHSNReq = true, isDescrReq = true;3706 var isITAmt = true, isSTUTAmt = true, isCTAmt = true;3707 if (iInv['Integrated Tax Amount']) {3708 isSTUTAmt = false; isCTAmt = false;3709 } else if (iInv['Central Tax Amount'] && iInv['State/UT Tax Amount']) {3710 isITAmt = false;3711 }3712 if (!iInv['Central Tax Amount']) {3713 iInv['Central Tax Amount'] = '';3714 }3715 if (!iInv['State/UT Tax Amount']) {3716 iInv['State/UT Tax Amount'] = '';3717 }3718 if (!iInv['Integrated Tax Amount']) {3719 iInv['Integrated Tax Amount'] = '';3720 }3721 if (!iInv['Cess Amount']) {3722 iInv['Cess Amount'] = '';3723 }3724 if (iInv['HSN']) {3725 isDescrReq = false;3726 }3727 else if (iInv['Description']) {3728 isHSNReq = false;3729 }3730 if (!iInv['Description'])3731 iInv['Description'] = '';3732 // as per system, either HSN or DESCRIPTION is required3733 // changes undo done by vasu3734 if (iInv['UQC'])3735 iInv['UQC'] = (iInv['UQC']).trim()3736 isPttnMthced = (3737 validatePattern(iInv['HSN'], isHSNReq, /^[0-9]{2,8}$/) &&3738 validatePattern(iInv['Description'], isDescrReq, /^[ A-Za-z0-9_@./&-]{0,30}$/) &&3739 validatePattern(iInv['UQC'], true, /^[a-zA-Z0-9 -]*$/) &&3740 validatePattern(iInv['Total Quantity'], true, /^([-]?[0-9]{0,15}|[-]?[0-9]{0,15}\.{1}[0-9]{0,2})$/) &&3741 validatePattern(Math.abs(iInv['Total Value']), true, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3742 validatePattern(Math.abs(iInv['Taxable Value']), true, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3743 validatePattern(Math.abs(iInv['Integrated Tax Amount']), isITAmt, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3744 validatePattern(Math.abs(iInv['Central Tax Amount']), isCTAmt, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3745 validatePattern(Math.abs(iInv['State/UT Tax Amount']), isSTUTAmt, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3746 validatePattern(Math.abs(iInv['Cess Amount']), false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/)3747 );3748 //isPttnMthced = true;3749 break;3750 case 'itc_rvsl': // GSTR23751 isPttnMthced = (3752 validatePattern(iInv['ITC Integrated Tax Amount'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3753 validatePattern(iInv['ITC Central Tax Amount'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3754 validatePattern(iInv['ITC State/UT Tax Amount'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3755 validatePattern(iInv['ITC Cess Amount'], false, /^(\d{0,13})(\.\d{0,2})?$/)3756 );3757 break;3758 case 'atadj': // GSTR23759 isPttnMthced = (3760 validatePattern(iInv['Place Of Supply'], true, null, true) &&3761 validatePattern(iInv['Gross Advance Paid to be Adjusted'], true, /^(\d{0,13})(\.\d{0,2})?$/) &&3762 validatePattern(iInv['Rate'], true, /^(0|0.25|0.1|0.10|3|5|12|18|28)$/) &&3763 validatePattern(iInv['Cess Adjusted'], false, /^(\d{0,13})(\.\d{0,2})?$/) &&3764 validatePattern(iInv['Supply Type'], true, /^(Inter State|Intra State)$/)3765 );3766 break;3767 case 'nil': // GSTR23768 isPttnMthced = (3769 validatePattern(iInv['Nil Rated Supplies'], false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3770 validatePattern(iInv['Exempted (other than nil rated/non GST supply )'], false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3771 validatePattern(iInv['Non-GST supplies'], false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3772 validatePattern(iInv['Composition taxable person'], false, /^(\-?(\d{0,13})(\.\d{0,2})?)$/) &&3773 (3774 iInv['Description'] == 'Inter-State supplies' ||3775 iInv['Description'] == 'Intra-State supplies'3776 )3777 )3778 break;3779 }3780 // isPttnMthced = true;3781 }3782 return isPttnMthced;3783}3784function validateExcelData(iExInv, iSecID, iForm) {3785 var isValidDt = false,3786 isValidData = false;3787 if (iForm === "GSTR1") {3788 switch (iSecID) {3789 case 'b2b':3790 isValidData = (3791 iExInv.hasOwnProperty('GSTIN/UIN of Recipient') &&3792 iExInv.hasOwnProperty('Invoice Number') &&3793 iExInv.hasOwnProperty('Invoice date') &&3794 iExInv.hasOwnProperty('Invoice Type') &&3795 iExInv.hasOwnProperty('Invoice Value') &&3796 iExInv.hasOwnProperty('Place Of Supply') &&3797 iExInv.hasOwnProperty('Reverse Charge')3798 /*&&3799 iExInv.hasOwnProperty('Provisional Assessment')*/3800 );3801 break;3802 case 'b2ba':3803 isValidData = (3804 iExInv.hasOwnProperty('Revised Invoice Number') &&3805 iExInv.hasOwnProperty('Revised Invoice date') &&3806 iExInv.hasOwnProperty('GSTIN/UIN of Recipient') &&3807 iExInv.hasOwnProperty('Original Invoice Number') &&3808 iExInv.hasOwnProperty('Original Invoice date') &&3809 iExInv.hasOwnProperty('Invoice Type') &&3810 iExInv.hasOwnProperty('Invoice Value') &&3811 iExInv.hasOwnProperty('Place Of Supply') &&3812 iExInv.hasOwnProperty('Reverse Charge')3813 /* &&3814 iExInv.hasOwnProperty('Provisional Assessment')*/3815 );3816 break;3817 break;3818 case 'b2cl':3819 isValidData = (3820 /*iExInv.hasOwnProperty('Recipient State Code') &&3821 iExInv.hasOwnProperty('Recipient Name') &&*/3822 iExInv.hasOwnProperty('Invoice Number') &&3823 iExInv.hasOwnProperty('Invoice date') &&3824 iExInv.hasOwnProperty('Rate') &&3825 iExInv.hasOwnProperty('Invoice Value') &&3826 iExInv.hasOwnProperty('Place Of Supply')3827 /*iExInv.hasOwnProperty('Provisional Assessment')*/3828 );3829 break;3830 case 'b2cla':3831 isValidData = (3832 /*iExInv.hasOwnProperty('Recipient State Code') &&3833 iExInv.hasOwnProperty('Recipient Name') &&*/3834 iExInv.hasOwnProperty('Original Invoice Number') &&3835 iExInv.hasOwnProperty('Original Invoice date') &&3836 iExInv.hasOwnProperty('Revised Invoice Number') &&3837 iExInv.hasOwnProperty('Revised Invoice date') &&3838 iExInv.hasOwnProperty('Rate') &&3839 iExInv.hasOwnProperty('Invoice Value') &&3840 iExInv.hasOwnProperty('Original Place Of Supply')3841 /*iExInv.hasOwnProperty('Provisional Assessment')*/3842 );3843 break;3844 case 'at':3845 isValidData = (3846 iExInv.hasOwnProperty('Place Of Supply') &&3847 iExInv.hasOwnProperty("Gross Advance Received") ||3848 iExInv.hasOwnProperty("Cess Amount"));3849 break;3850 case 'ata':3851 /*isValidData = (3852 iExInv.hasOwnProperty('Recipient State Code') &&3853 iExInv.hasOwnProperty('Revised Customer GSTIN/UIN/Name') &&3854 iExInv.hasOwnProperty('Original Customer GSTIN/UIN/Name') &&3855 iExInv.hasOwnProperty('Original Document Number') &&3856 iExInv.hasOwnProperty('Original Document date') &&3857 iExInv.hasOwnProperty('Revised Document Number') &&3858 iExInv.hasOwnProperty('Revised Document date') &&3859 iExInv.hasOwnProperty('Total Invoice Value'));*/3860 isValidData = (3861 iExInv.hasOwnProperty('Financial Year') &&3862 iExInv.hasOwnProperty('Original Month') &&3863 iExInv.hasOwnProperty('Original Place Of Supply') &&3864 iExInv.hasOwnProperty("Gross Advance Received") ||3865 iExInv.hasOwnProperty("Cess Amount"));3866 break;3867 case 'exp':3868 isValidData = (3869 iExInv.hasOwnProperty('Export Type') ||3870 iExInv.hasOwnProperty('Shipping Bill Number') ||3871 iExInv.hasOwnProperty('Shipping Bill Date') ||3872 iExInv.hasOwnProperty('Port Code') &&3873 iExInv.hasOwnProperty('Invoice Number') &&3874 iExInv.hasOwnProperty('Invoice date') &&3875 iExInv.hasOwnProperty('Invoice Value'));3876 break;3877 case 'expa':3878 isValidData = (3879 iExInv.hasOwnProperty('Export Type') ||3880 iExInv.hasOwnProperty('Shipping Bill Number') ||3881 iExInv.hasOwnProperty('Shipping Bill Date') ||3882 iExInv.hasOwnProperty('Port Code') &&3883 iExInv.hasOwnProperty('Revised Invoice Number') &&3884 iExInv.hasOwnProperty('Revised Invoice date') &&3885 iExInv.hasOwnProperty('Original Invoice Number') &&3886 iExInv.hasOwnProperty('Original Invoice date') &&3887 iExInv.hasOwnProperty('Invoice Value'));3888 break;3889 case 'cdnr':3890 isValidData = (3891 iExInv.hasOwnProperty('GSTIN/UIN of Recipient') &&3892 iExInv.hasOwnProperty('Note/Refund Voucher Number') &&3893 iExInv.hasOwnProperty('Note/Refund Voucher date') &&3894 iExInv.hasOwnProperty('Document Type') &&3895 // iExInv.hasOwnProperty('Reason For Issuing document') &&3896 iExInv.hasOwnProperty('Invoice/Advance Receipt Number') &&3897 iExInv.hasOwnProperty('Invoice/Advance Receipt date') &&3898 iExInv.hasOwnProperty('Place Of Supply') &&3899 iExInv.hasOwnProperty('Pre GST') &&3900 iExInv.hasOwnProperty('Note/Refund Voucher Value') &&3901 iExInv.hasOwnProperty('Taxable Value')3902 );3903 break;3904 case 'cdnur':3905 if (!iExInv.hasOwnProperty('Place Of Supply'))3906 iExInv['Place Of Supply'] = '';3907 isValidData = (3908 iExInv.hasOwnProperty('Note/Refund Voucher Number') &&3909 iExInv.hasOwnProperty('Note/Refund Voucher date') &&3910 iExInv.hasOwnProperty('Document Type') &&3911 // iExInv.hasOwnProperty('Reason For Issuing document') &&3912 iExInv.hasOwnProperty('Invoice/Advance Receipt Number') &&3913 (iExInv['Invoice/Advance Receipt Number']) &&3914 iExInv.hasOwnProperty('Invoice/Advance Receipt date') &&3915 iExInv.hasOwnProperty('Note/Refund Voucher Value') &&3916 (iExInv['Note/Refund Voucher Value']) &&3917 iExInv.hasOwnProperty('Pre GST') &&3918 iExInv.hasOwnProperty('Place Of Supply') &&3919 iExInv.hasOwnProperty('UR Type') &&3920 iExInv.hasOwnProperty('Taxable Value'));3921 break;3922 case 'cdnra':3923 isValidData = (3924 iExInv.hasOwnProperty('GSTIN/UIN of Recipient') &&3925 iExInv.hasOwnProperty('Original Note/Refund Voucher Number') &&3926 iExInv.hasOwnProperty('Original Note/Refund Voucher date') &&3927 iExInv.hasOwnProperty('Revised Note/Refund Voucher Number') &&3928 iExInv.hasOwnProperty('Revised Note/Refund Voucher date') &&3929 iExInv.hasOwnProperty('Document Type') &&3930 // iExInv.hasOwnProperty('Reason For Issuing document') &&3931 iExInv.hasOwnProperty('Original Invoice/Advance Receipt Number') &&3932 iExInv.hasOwnProperty('Original Invoice/Advance Receipt date') &&3933 iExInv.hasOwnProperty('Pre GST') &&3934 iExInv.hasOwnProperty('Supply Type') &&3935 //iExInv.hasOwnProperty('Place Of Supply') &&3936 iExInv.hasOwnProperty('Note/Refund Voucher Value') &&3937 // iExInv.hasOwnProperty('E-Commerce GSTIN') &&3938 iExInv.hasOwnProperty('Taxable Value'));3939 break;3940 case 'cdnura':3941 isValidData = (3942 iExInv.hasOwnProperty('Original Note/Refund Voucher Number') &&3943 iExInv.hasOwnProperty('Original Note/Refund Voucher date') &&3944 iExInv.hasOwnProperty('Revised Note/Refund Voucher Number') &&3945 iExInv.hasOwnProperty('Revised Note/Refund Voucher date') &&3946 iExInv.hasOwnProperty('Document Type') &&3947 // iExInv.hasOwnProperty('Reason For Issuing document') &&3948 iExInv.hasOwnProperty('Original Invoice/Advance Receipt Number') &&3949 (iExInv['Original Invoice/Advance Receipt Number']) &&3950 iExInv.hasOwnProperty('Original Invoice/Advance Receipt date') &&3951 iExInv.hasOwnProperty('Note/Refund Voucher Value') &&3952 (iExInv['Note/Refund Voucher Value']) &&3953 iExInv.hasOwnProperty('Pre GST') &&3954 iExInv.hasOwnProperty('Supply Type') &&3955 //iExInv.hasOwnProperty('Place Of Supply') &&3956 iExInv.hasOwnProperty('UR Type') &&3957 iExInv.hasOwnProperty('Taxable Value'));3958 break;3959 case 'b2cs':3960 isValidData = (3961 iExInv.hasOwnProperty('Place Of Supply') &&3962 iExInv.hasOwnProperty('Taxable Value') &&3963 iExInv.hasOwnProperty('Type'));3964 break;3965 case 'b2csa':3966 isValidData = (3967 iExInv.hasOwnProperty('Financial Year') &&3968 iExInv.hasOwnProperty('Original Month') &&3969 iExInv.hasOwnProperty('Revised Place Of Supply') &&3970 iExInv.hasOwnProperty('Original Place Of Supply') &&3971 iExInv.hasOwnProperty('Taxable Value') &&3972 iExInv.hasOwnProperty('Type'));3973 break;3974 case 'atadj':3975 isValidData = (3976 iExInv.hasOwnProperty('Place Of Supply') &&3977 iExInv.hasOwnProperty("Gross Advance Adjusted") ||3978 iExInv.hasOwnProperty("Cess Amount"));3979 break;3980 case 'atadja':3981 isValidData = (3982 iExInv.hasOwnProperty('Financial Year') &&3983 iExInv.hasOwnProperty('Original Month') &&3984 iExInv.hasOwnProperty('Original Place Of Supply') &&3985 iExInv.hasOwnProperty("Gross Advance Adjusted") ||3986 iExInv.hasOwnProperty("Cess Amount"));3987 break;3988 case 'hsn':3989 isValidData = (3990 (3991 (iExInv.hasOwnProperty('HSN') && iExInv['HSN'] != '')3992 ||3993 (iExInv.hasOwnProperty('Description') && iExInv['Description'] != '')3994 )3995 &&3996 iExInv.hasOwnProperty('UQC') &&3997 iExInv.hasOwnProperty('Total Quantity') &&3998 iExInv.hasOwnProperty('Total Value') &&3999 iExInv.hasOwnProperty('Taxable Value'));4000 break;4001 case 'nil':4002 isValidData = (4003 iExInv.hasOwnProperty('Description') ||4004 iExInv.hasOwnProperty("Nil Rated Supplies") ||4005 iExInv.hasOwnProperty("Exempted(other than nil rated/non GST supply)") ||4006 iExInv.hasOwnProperty("Non-GST Supplies")4007 );4008 break;4009 case 'doc_issue':4010 isValidData = (4011 iExInv.hasOwnProperty('Nature of Document') &&4012 iExInv.hasOwnProperty("Sr. No. From") &&4013 iExInv.hasOwnProperty("Sr. No. To") &&4014 iExInv.hasOwnProperty("Total Number") &&4015 iExInv.hasOwnProperty("Cancelled")4016 );4017 break;4018 }4019 } else if (iForm === "GSTR2") {4020 switch (iSecID) {4021 case 'b2b': // GSTR24022 isValidData = (4023 iExInv.hasOwnProperty('GSTIN of Supplier') ||4024 iExInv.hasOwnProperty('Supplier Name') &&4025 iExInv.hasOwnProperty('Invoice Number') &&4026 iExInv.hasOwnProperty('Invoice date') &&4027 iExInv.hasOwnProperty('Invoice Value') &&4028 iExInv.hasOwnProperty('Place Of Supply') &&4029 iExInv.hasOwnProperty('Reverse Charge')4030 );4031 break;4032 case 'b2bur': // GSTR24033 isValidData = (4034 iExInv.hasOwnProperty('Supplier Name') &&4035 iExInv.hasOwnProperty('Invoice Number') &&4036 iExInv.hasOwnProperty('Invoice date') &&4037 iExInv.hasOwnProperty('Invoice Value') &&4038 iExInv.hasOwnProperty('Supply Type') &&4039 iExInv.hasOwnProperty('Place Of Supply')4040 );4041 break;4042 case 'b2ba': // GSTR24043 isValidData = (4044 iExInv.hasOwnProperty('Supplier GSTIN') &&4045 iExInv.hasOwnProperty('Original Invoice Number') &&4046 iExInv.hasOwnProperty('Original Invoice date') &&4047 iExInv.hasOwnProperty('Revised Invoice Number') &&4048 iExInv.hasOwnProperty('Revised Invoice date') &&4049 iExInv.hasOwnProperty('Total Invoice Value') &&4050 iExInv.hasOwnProperty('Place Of Supply') &&4051 iExInv.hasOwnProperty('Reverse Charge')4052 );4053 break;4054 case 'b2bura': // GSTR24055 isValidData = (4056 iExInv.hasOwnProperty('Supplier Name') &&4057 iExInv.hasOwnProperty('Original Invoice Number') &&4058 iExInv.hasOwnProperty('Original Invoice date') &&4059 iExInv.hasOwnProperty('Revised Invoice Number') &&4060 iExInv.hasOwnProperty('Revised Invoice date') &&4061 iExInv.hasOwnProperty('Total Invoice Value') &&4062 iExInv.hasOwnProperty('Place Of Supply') &&4063 iExInv.hasOwnProperty('Reverse Charge')4064 );4065 break;4066 case 'cdnr': // GSTR24067 isValidData = (4068 iExInv.hasOwnProperty('GSTIN of Supplier') ||4069 iExInv.hasOwnProperty('Supplier Name') &&4070 iExInv.hasOwnProperty('Note/Refund Voucher Number') &&4071 iExInv.hasOwnProperty('Note/Refund Voucher date') &&4072 iExInv.hasOwnProperty('Document Type') &&4073 iExInv.hasOwnProperty('Supply Type') &&4074 iExInv.hasOwnProperty('Reason For Issuing document') &&4075 iExInv.hasOwnProperty('Invoice/Advance Payment Voucher Number') &&4076 iExInv.hasOwnProperty('Invoice/Advance Payment Voucher date') &&4077 iExInv.hasOwnProperty('Pre GST') &&4078 iExInv.hasOwnProperty('Taxable Value')4079 );4080 break;4081 case 'cdnur': // GSTR24082 isValidData = (4083 iExInv.hasOwnProperty('Note/Voucher Number') &&4084 iExInv.hasOwnProperty('Note/Voucher date') &&4085 iExInv.hasOwnProperty('Document Type') &&4086 iExInv.hasOwnProperty('Reason For Issuing document') &&4087 iExInv.hasOwnProperty('Invoice/Advance Payment Voucher number') &&4088 iExInv.hasOwnProperty('Invoice/Advance Payment Voucher date') &&4089 iExInv.hasOwnProperty('Pre GST') &&4090 iExInv.hasOwnProperty('Invoice Type') &&4091 iExInv.hasOwnProperty('Taxable Value')4092 );4093 break;4094 case 'cdnra': // GSTR24095 isValidData = (4096 iExInv.hasOwnProperty('Supplier GSTIN') &&4097 iExInv.hasOwnProperty('Original Debit Note Number') &&4098 iExInv.hasOwnProperty('Original Debit Note date') &&4099 iExInv.hasOwnProperty('Revised Debit Note Number') &&4100 iExInv.hasOwnProperty('Revised Debit Note date') &&4101 iExInv.hasOwnProperty('Note Type') &&4102 iExInv.hasOwnProperty('Reason For Issuing Note') &&4103 iExInv.hasOwnProperty('Invoice Number') &&4104 iExInv.hasOwnProperty('Invoice date') &&4105 iExInv.hasOwnProperty('Total Invoice Value'));4106 break;4107 case 'imp_g': // GSTR24108 isValidData = (4109 iExInv.hasOwnProperty('Port Code') &&4110 iExInv.hasOwnProperty('Bill Of Entry Number') &&4111 iExInv.hasOwnProperty('Bill Of Entry Date') &&4112 iExInv.hasOwnProperty('Bill Of Entry Value'));4113 break;4114 case 'imp_ga': // GSTR24115 isValidData = (4116 iExInv.hasOwnProperty('Port Code') &&4117 iExInv.hasOwnProperty('Document type') &&4118 iExInv.hasOwnProperty('Original Bill Of Entry Number') &&4119 iExInv.hasOwnProperty('Original Bill Of Entry date') &&4120 iExInv.hasOwnProperty('Revised Bill Of Entry Number') &&4121 iExInv.hasOwnProperty('Revised Bill Of Entry date') &&4122 iExInv.hasOwnProperty('Total Invoice Value'));4123 break;4124 case 'imp_s': // GSTR24125 isValidData = (4126 iExInv.hasOwnProperty('Invoice Number of Reg Recipient') &&4127 (iExInv.hasOwnProperty('Invoice date') || iExInv.hasOwnProperty('Invoice Date')) &&//there is a mismatch between the excel template and then export excel template4128 iExInv.hasOwnProperty('Place Of Supply') &&4129 iExInv.hasOwnProperty('Invoice Value'));4130 break;4131 case 'imp_sa': // GSTR24132 isValidData = (4133 iExInv.hasOwnProperty('Original Invoice Number') &&4134 iExInv.hasOwnProperty('Original Invoice date') &&4135 iExInv.hasOwnProperty('Revised Invoice Number') &&4136 iExInv.hasOwnProperty('Revised Invoice date') &&4137 iExInv.hasOwnProperty('Total Invoice Value'));4138 break;4139 case 'txi': // GSTR24140 if (!iExInv.hasOwnProperty("Cess Amount"))4141 iExInv['Cess Amount'] = 0;4142 isValidData = (4143 iExInv.hasOwnProperty('Place Of Supply') &&4144 iExInv.hasOwnProperty("Gross Advance Paid") &&4145 iExInv.hasOwnProperty("Cess Amount") &&4146 iExInv.hasOwnProperty("Supply Type"));4147 break;4148 case 'atxi': // GSTR24149 isValidData = (4150 iExInv.hasOwnProperty('Recipient State Code') &&4151 iExInv.hasOwnProperty('Revised Supplier GSTIN') &&4152 iExInv.hasOwnProperty('Original Supplier GSTIN') &&4153 iExInv.hasOwnProperty('Original Document Number') &&4154 iExInv.hasOwnProperty('Original Document date') &&4155 iExInv.hasOwnProperty('Revised Document Number') &&4156 iExInv.hasOwnProperty('Revised Document date'));4157 break;4158 case 'hsnsum': // GSTR24159 isValidData = (4160 (4161 (iExInv.hasOwnProperty('HSN') && iExInv['HSN'] != '')4162 ||4163 (iExInv.hasOwnProperty('Description') && iExInv['Description'] != '')4164 ) &&4165 iExInv.hasOwnProperty('UQC') &&4166 iExInv.hasOwnProperty('Total Quantity') &&4167 iExInv.hasOwnProperty('Total Value') &&4168 iExInv.hasOwnProperty('Taxable Value') &&4169 iExInv.hasOwnProperty('Integrated Tax Amount') &&4170 iExInv.hasOwnProperty('Central Tax Amount') &&4171 iExInv.hasOwnProperty('State/UT Tax Amount') &&4172 iExInv.hasOwnProperty('Cess Amount'));4173 break;4174 /*added this case as per the new excel by sridhar*/4175 case 'itc_rvsl': // GSTR24176 isValidData = (4177 iExInv.hasOwnProperty('Description for reversal of ITC') /*&&4178 iExInv.hasOwnProperty('ITC Integrated Tax Amount') &&4179 iExInv.hasOwnProperty('ITC Central Tax Amount') &&4180 iExInv.hasOwnProperty('ITC State/UT Tax Amount') &&4181 iExInv.hasOwnProperty('ITC Cess Amount')*/);4182 break;4183 case 'atadj': // GSTR24184 if (!iExInv.hasOwnProperty("Cess Adjusted"))4185 iExInv['Cess Adjusted'] = 0;4186 isValidData = (4187 iExInv.hasOwnProperty('Place Of Supply') &&4188 iExInv.hasOwnProperty("Gross Advance Paid to be Adjusted") &&4189 iExInv.hasOwnProperty("Cess Adjusted") &&4190 iExInv.hasOwnProperty("Supply Type"));4191 break;4192 case 'nil': // GSTR24193 isValidData = (4194 iExInv.hasOwnProperty('Description') &&4195 iExInv.hasOwnProperty("Nil Rated Supplies") &&4196 iExInv.hasOwnProperty("Exempted (other than nil rated/non GST supply )") &&4197 iExInv.hasOwnProperty("Non-GST supplies")4198 );4199 break;4200 }4201 }4202 return (isValidData);4203}4204//To check all values at invoice level inorder to add multi items from excel4205function validateInvoice(iForm, iSecID, iExInv, existingInv, iYearsList) {4206 var isFieldsMatch = false;4207 if (iExInv['Place Of Supply']) {4208 iExInv['Place Of Supply'] = (iExInv['Place Of Supply']).substring(0, 2);4209 }4210 if (iExInv['Recipient State Code']) {4211 iExInv['Recipient State Code'] = (iExInv['Recipient State Code'] < 10) ? "0" + iExInv['Recipient State Code'] : "" + iExInv['Recipient State Code'];4212 }4213 if (iExInv['Original State Code']) {4214 iExInv['Original State Code'] = (iExInv['Original State Code'] < 10) ? "0" + iExInv['Original State Code'] : "" + iExInv['Original State Code'];4215 }4216 if (iForm === "GSTR1") {4217 switch (iSecID) {4218 case 'b2b':4219 isFieldsMatch = (iExInv['GSTIN/UIN of Recipient'] == existingInv['ctin'] &&4220 (iExInv['Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4221 iExInv['Invoice date'] == existingInv['idt'] &&4222 iExInv['Invoice Value'] == existingInv['val'] &&4223 iExInv['Place Of Supply'] == existingInv['pos'] &&4224 iExInv['Reverse Charge'] == existingInv['rchrg'] &&4225 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4226 iExInv['E-Commerce GSTIN'] == existingInv['etin']4227 );4228 // && validateItm(iForm, iSecID, iExInv, existingInv)4229 /*iExInv['Provisional Assessment'] == existingInv['prs']);*/4230 break;4231 case 'b2ba':4232 isFieldsMatch = (iExInv['GSTIN/UIN of Recipient'] == existingInv['ctin'] &&4233 (iExInv['Original Invoice Number']).toLowerCase() == (existingInv['oinum']).toLowerCase() &&4234 iExInv['Original Invoice date'] == existingInv['oidt'] &&4235 (iExInv['Revised Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4236 iExInv['Revised Invoice date'] == existingInv['idt'] &&4237 iExInv['Invoice Value'] == existingInv['val'] &&4238 iExInv['Place Of Supply'] == existingInv['pos'] &&4239 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4240 iExInv['Reverse Charge'] == existingInv['rchrg']);4241 break;4242 case 'b2cl':4243 isFieldsMatch = ( /*iExInv['Recipient State Code'] == existingInv['state_cd'] &&*/4244 /*iExInv['Recipient Name'] == existingInv['cname'] &&*/4245 (iExInv['Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4246 iExInv['Invoice date'] == existingInv['idt'] &&4247 iExInv['Invoice Value'] == existingInv['val'] &&4248 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4249 iExInv['Place Of Supply'] == existingInv['pos']);4250 /*iExInv['Provisional Assessment'] == existingInv['prs'])*/4251 break;4252 case 'b2cla':4253 isFieldsMatch = ( /*iExInv['Recipient State Code'] == existingInv['state_cd'] &&*/4254 /*iExInv['Recipient Name'] == existingInv['cname'] &&*/4255 (iExInv['Original Invoice Number']).toLowerCase() == (existingInv['oinum']).toLowerCase() &&4256 iExInv['Original Invoice date'] == existingInv['oidt'] &&4257 (iExInv['Revised Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4258 iExInv['Revised Invoice date'] == existingInv['idt'] &&4259 iExInv['Invoice Value'] == existingInv['val'] &&4260 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4261 iExInv['Original Place Of Supply'].substring(0, 2) == existingInv['pos']4262 /*iExInv['Provisional Assessment'] == existingInv['prs']*/4263 );4264 break;4265 case 'at':4266 isFieldsMatch = (iExInv['Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4267 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent']);4268 break;4269 case 'ata':4270 var year = iExInv['Financial Year'],4271 month = iExInv['Original Month'],4272 curntOMon = isValidRtnPeriod(iYearsList, year, month).monthValue;4273 isFieldsMatch = (iExInv['Original Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4274 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4275 curntOMon == existingInv['omon']4276 );4277 break;4278 case 'exp':4279 isFieldsMatch = (iExInv['Export Type'] == existingInv['exp_typ'] &&4280 parseInt(iExInv['Shipping Bill Number']) == existingInv['sbnum'] &&4281 iExInv['Port Code'] == existingInv['sbpcode'] &&4282 iExInv['Shipping Bill Date'] == existingInv['sbdt'] &&4283 (iExInv['Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4284 iExInv['Invoice date'] == existingInv['idt'] &&4285 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4286 iExInv['Invoice Value'] == existingInv['val']);4287 break;4288 case 'expa':4289 isFieldsMatch = (iExInv['Export Type'] == existingInv['exp_typ'] &&4290 iExInv['Shipping Bill Number'] == existingInv['sbnum'] &&4291 iExInv['Port Code'] == existingInv['sbpcode'] &&4292 iExInv['Shipping Bill Date'] == existingInv['sbdt'] &&4293 (iExInv['Original Invoice Number']).toLowerCase() == (existingInv['oinum']).toLowerCase() &&4294 iExInv['Original Invoice date'] == existingInv['oidt'] &&4295 (iExInv['Revised Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4296 iExInv['Revised Invoice date'] == existingInv['idt'] &&4297 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4298 iExInv['Invoice Value'] == existingInv['val']);4299 break;4300 case 'cdnr':4301 //Field name changed for4302 // if()4303 isFieldsMatch = (iExInv['GSTIN/UIN of Recipient'] == existingInv['ctin'] &&4304 iExInv['Note/Refund Voucher Number'] == existingInv['nt_num'] &&4305 iExInv['Note/Refund Voucher date'] == existingInv['nt_dt'] &&4306 iExInv['Document Type'] == existingInv['ntty'] &&4307 // iExInv['Reason For Issuing document'] == existingInv['rsn'] &&4308 iExInv['Invoice/Advance Receipt Number'] == existingInv['inum'] &&4309 iExInv['Invoice/Advance Receipt date'] == existingInv['idt'] &&4310 iExInv['Pre GST'] == existingInv['p_gst'] &&4311 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4312 iExInv['Place Of Supply'] == existingInv['pos'] &&4313 iExInv['Note/Refund Voucher Value'] == existingInv['val']);4314 // iExInv['E-Commerce GSTIN'] == existingInv['etin'] &&4315 // iExInv['Taxable Value'] == existingInv['txval']);4316 break;4317 case 'cdnur':4318 isFieldsMatch = (/*iExInv['GSTIN/UIN of Recipient'] == existingInv['ctin'] &&*/4319 iExInv['Note/Refund Voucher Number'] == existingInv['nt_num'] &&4320 iExInv['Note/Refund Voucher date'] == existingInv['nt_dt'] &&4321 iExInv['Document Type'] == existingInv['ntty'] &&4322 // iExInv['Reason For Issuing document'] == existingInv['rsn'] &&4323 iExInv['Invoice/Advance Receipt Number'] == existingInv['inum'] &&4324 iExInv['Invoice/Advance Receipt date'] == existingInv['idt'] &&4325 iExInv['Pre GST'] == existingInv['p_gst'] &&4326 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4327 iExInv['Place Of Supply'] == existingInv['pos'] &&4328 iExInv['UR Type'] == existingInv['typ'] &&4329 iExInv['Note/Refund Voucher Value'] == existingInv['val']);4330 break;4331 case 'cdnra':4332 isFieldsMatch = (iExInv['GSTIN/UIN of Recipient'] == existingInv['ctin'] &&4333 iExInv['Original Note/Refund Voucher Number'] == existingInv['ont_num'] &&4334 iExInv['Original Note/Refund Voucher date'] == existingInv['ont_dt'] &&4335 iExInv['Revised Note/Refund Voucher Number'] == existingInv['nt_num'] &&4336 iExInv['Revised Note/Refund Voucher date'] == existingInv['nt_dt'] &&4337 iExInv['Document Type'] == existingInv['ntty'] &&4338 // iExInv['Reason For Issuing document'] == existingInv['rsn'] &&4339 iExInv['Original Invoice/Advance Receipt Number'] == existingInv['inum'] &&4340 iExInv['Original Invoice/Advance Receipt date'] == existingInv['idt'] &&4341 iExInv['Pre GST'] == existingInv['p_gst'] &&4342 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4343 iExInv['Place Of Supply'] == existingInv['pos'] &&4344 iExInv['Note/Refund Voucher Value'] == existingInv['val']);4345 break;4346 case 'cdnura':4347 isFieldsMatch = (/*iExInv['GSTIN/UIN of Recipient'] == existingInv['ctin'] &&*/4348 iExInv['Original Note/Refund Voucher Number'] == existingInv['ont_num'] &&4349 iExInv['Original Note/Refund Voucher date'] == existingInv['ont_dt'] &&4350 iExInv['Revised Note/Refund Voucher Number'] == existingInv['nt_num'] &&4351 iExInv['Revised Note/Refund Voucher date'] == existingInv['nt_dt'] &&4352 iExInv['Document Type'] == existingInv['ntty'] &&4353 // iExInv['Reason For Issuing document'] == existingInv['rsn'] &&4354 iExInv['Original Invoice/Advance Receipt Number'] == existingInv['inum'] &&4355 iExInv['Original Invoice/Advance Receipt date'] == existingInv['idt'] &&4356 iExInv['Pre GST'] == existingInv['p_gst'] &&4357 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4358 iExInv['Place Of Supply'] == existingInv['pos'] &&4359 iExInv['UR Type'] == existingInv['typ'] &&4360 iExInv['Note/Refund Voucher Value'] == existingInv['val']);4361 break;4362 case 'b2cs':4363 isFieldsMatch = (iExInv['Place Of Supply'] == existingInv['pos'] &&4364 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4365 iExInv['Type'] == existingInv['typ']);4366 break;4367 case 'b2csa':4368 var year = iExInv['Financial Year'],4369 month = iExInv['Original Month'],4370 curntOMon = isValidRtnPeriod(iYearsList, year, month).monthValue;4371 isFieldsMatch = (iExInv['Original Place Of Supply'].slice(0, 2) == existingInv['opos'] &&4372 iExInv['Revised Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4373 iExInv['Type'] == existingInv['typ']) &&4374 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4375 curntOMon == existingInv['omon']4376 break;4377 case 'atadj':4378 isFieldsMatch = (iExInv['Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4379 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent']);4380 break;4381 case 'atadja':4382 var year = iExInv['Financial Year'],4383 month = iExInv['Original Month'],4384 curntOMon = isValidRtnPeriod(iYearsList, year, month).monthValue;4385 isFieldsMatch = (iExInv['Original Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4386 iExInv['Applicable % of Tax Rate'] == existingInv['diff_percent'] &&4387 curntOMon == existingInv['omon']4388 );4389 break;4390 case 'hsn':4391 isFieldsMatch = (4392 iExInv['HSN'] == existingInv['hsn_sc'] &&4393 iExInv['Description'] == existingInv['desc']4394 );4395 break;4396 case 'nil':4397 isFieldsMatch = (4398 iExInv['Description'] == existingInv['sply_ty'] &&4399 iExInv['Nil Rated Supplies'] == existingInv['nil_amt'] &&4400 iExInv['Exempted(other than nil rated/non-GST supply)'] == existingInv['expt_amt'] &&4401 iExInv['Non-GST Supplies '] == existingInv['ngsup_amt']4402 );4403 break;4404 case 'doc_issue':4405 isFieldsMatch = (4406 iExInv['Nature of Document'] == existingInv['doc_typ']4407 );4408 break;4409 }4410 } else if (iForm === "GSTR2") {4411 switch (iSecID) {4412 case 'b2b': // GSTR24413 isFieldsMatch = (iExInv['GSTIN of Supplier'] == existingInv['ctin'] &&4414 iExInv['Supplier Name'] == existingInv['cname'] &&4415 (iExInv['Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4416 iExInv['Invoice date'] == existingInv['idt'] &&4417 iExInv['Invoice Value'] == existingInv['val'] &&4418 iExInv['Place Of Supply'] == existingInv['pos'] &&4419 iExInv['Reverse Charge'] == existingInv['rchrg']);4420 //S06102017 : Change for saved and add4421 //if (iExInv['Saved/Submitted'] == "Saved" && iExInv['Action'] == 'Add') {4422 // isFieldsMatch = false;4423 // }4424 //End of S061020174425 break;4426 case 'b2bur': // GSTR24427 isFieldsMatch = (4428 iExInv['Supplier Name'] == existingInv['cname'] &&4429 (iExInv['Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4430 iExInv['Invoice date'] == existingInv['idt'] &&4431 iExInv['Invoice Value'] == existingInv['val'] &&4432 iExInv['Place Of Supply'] == existingInv['pos']4433 );4434 break;4435 case 'b2ba': // GSTR24436 isFieldsMatch = (iExInv['Supplier GSTIN'] == existingInv['ctin'] &&4437 iExInv['Original Invoice Number'] == existingInv['oinum'] &&4438 iExInv['Original Invoice date'] == existingInv['oidt'] &&4439 (iExInv['Revised Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4440 iExInv['Revised Invoice date'] == existingInv['idt'] &&4441 iExInv['Total Invoice Value'] == existingInv['val'] &&4442 iExInv['Place Of Supply'] == existingInv['pos'] &&4443 iExInv['Reverse Charge'] == existingInv['rchrg']);4444 break;4445 case 'b2bura': // GSTR24446 isFieldsMatch = (iExInv['Supplier Name'] == existingInv['cname'] &&4447 iExInv['Original Invoice Number'] == existingInv['oinum'] &&4448 iExInv['Original Invoice date'] == existingInv['oidt'] &&4449 (iExInv['Revised Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4450 iExInv['Revised Invoice date'] == existingInv['idt'] &&4451 iExInv['Total Invoice Value'] == existingInv['val'] &&4452 iExInv['Place Of Supply'] == existingInv['pos'] &&4453 iExInv['Reverse Charge'] == existingInv['rchrg']);4454 break;4455 case 'cdnr': // GSTR24456 isFieldsMatch = (iExInv['GSTIN of Supplier'] == existingInv['ctin'] &&4457 iExInv['Supplier Name'] == existingInv['cname'] &&4458 iExInv['Note/Refund Voucher Number'] == existingInv['nt_num'] &&4459 iExInv['Note/Refund Voucher date'] == existingInv['nt_dt'] &&4460 iExInv['Document Type'] == existingInv['ntty'] &&4461 iExInv['Reason For Issuing document'] == existingInv['rsn'] &&4462 (iExInv['Invoice/Advance Payment Voucher Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4463 iExInv['Invoice/Advance Payment Voucher date'] == existingInv['idt'] &&4464 iExInv['Pre GST'] == existingInv['p_gst'] &&4465 iExInv['Supply Type'] == existingInv['sp_typ'] &&4466 iExInv['Note/Refund Voucher Value'] == existingInv['val']4467 );4468 break;4469 case 'cdnur': // GSTR24470 isFieldsMatch = (4471 iExInv['Note/Voucher Number'] == existingInv['nt_num'] &&4472 iExInv['Note/Voucher date'] == existingInv['nt_dt'] &&4473 iExInv['Document Type'] == existingInv['ntty'] &&4474 iExInv['Reason For Issuing document'] == existingInv['rsn'] &&4475 (iExInv['Invoice/Advance Payment Voucher number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4476 iExInv['Invoice/Advance Payment Voucher date'] == existingInv['idt'] &&4477 iExInv['Pre GST'] == existingInv['p_gst'] &&4478 iExInv['Supply Type'] == existingInv['sp_typ'] &&4479 iExInv['Invoice Type'] == existingInv['inv_typ'] &&4480 iExInv['Note/Voucher Value'] == existingInv['val']);4481 break;4482 case 'cdnra': // GSTR24483 isFieldsMatch = (iExInv['Supplier GSTIN'] == existingInv['ctin'] &&4484 iExInv['Original Debit Note Number'] == existingInv['ont_num'] &&4485 iExInv['Original Debit Note date'] == existingInv['ont_dt'] &&4486 iExInv['Revised Debit Note Number'] == existingInv['nt_num'] &&4487 iExInv['Revised Debit Note date'] == existingInv['nt_dt'] &&4488 iExInv['Note Type'] == existingInv['ntty'] &&4489 iExInv['Reason For Issuing Note'] == existingInv['rsn'] &&4490 (iExInv['Invoice Number']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4491 iExInv['Invoice date'] == existingInv['idt'] &&4492 iExInv['Total Invoice Value'] == existingInv['val']);4493 break;4494 case 'imp_g': // GSTR24495 isFieldsMatch = (iExInv['Bill Of Entry Number'] == existingInv['boe_num'] &&4496 iExInv['Bill Of Entry Date'] == existingInv['boe_dt'] &&4497 iExInv['Port Code'] == existingInv['port_code'] &&4498 iExInv['Bill Of Entry Value'] == existingInv['boe_val']);4499 break;4500 case 'imp_ga': // GSTR24501 isFieldsMatch = (iExInv['Original Bill Of Entry Number'] == existingInv['oboe_num'] &&4502 iExInv['Original Bill Of Entry date'] == existingInv['oboe_dt'] &&4503 iExInv['Revised Bill Of Entry Number'] == existingInv['boe_num'] &&4504 iExInv['Revised Bill Of Entry date'] == existingInv['boe_dt'] &&4505 iExInv['Port Code'] == existingInv['port_code'] &&4506 iExInv['Total Invoice Value'] == existingInv['boe_val']);4507 break;4508 case 'imp_s': // GSTR24509 var dateStr = "";4510 if (iExInv.hasOwnProperty('Invoice date'))4511 dateStr = iExInv['Invoice date'];4512 else4513 dateStr = iExInv['Invoice Date'];4514 isFieldsMatch = (4515 (iExInv['Invoice Number of Reg Recipient']).toLowerCase() == (existingInv['inum']).toLowerCase() &&4516 dateStr == existingInv['idt'] &&4517 iExInv['Place Of Supply'] == existingInv['pos'] &&4518 iExInv['Invoice Value'] == existingInv['ival']);4519 break;4520 case 'imp_sa': // GSTR24521 isFieldsMatch = (4522 (iExInv['Original Invoice Number']).toLowerCase() == (existingInv['oi_num']).toLowerCase() &&4523 iExInv['Original Invoice date'] == existingInv['oi_dt'] &&4524 (iExInv['Revised Invoice Number']).toLowerCase() == (existingInv['i_num']).toLowerCase() &&4525 iExInv['Revised Invoice date'] == existingInv['i_dt'] &&4526 iExInv['Total Invoice Value'] == existingInv['i_val']);4527 break;4528 case 'txi': // GSTR24529 isFieldsMatch = (iExInv['Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4530 iExInv['Supply Type'] == existingInv['sply_ty']);4531 break;4532 case 'atxi': // GSTR24533 isFieldsMatch = (iExInv['Recipient State Code'] == existingInv['state_cd'] &&4534 iExInv['Revised Supplier GSTIN'] == existingInv['cpty'] &&4535 iExInv['Original Supplier GSTIN'] == existingInv['ocpty'] &&4536 iExInv['Original Document Number'] == existingInv['odnum'] &&4537 iExInv['Type'] == existingInv['reg_type'] &&4538 iExInv['Original Document date'] == existingInv['otdt'] &&4539 iExInv['Revised Document Number'] == existingInv['dnum'] &&4540 iExInv['Revised Document date'] == existingInv['dt']);4541 break;4542 case 'hsnsum': // GSTR24543 isFieldsMatch = (4544 iExInv['HSN'] == existingInv['hsn_sc'] &&4545 iExInv['Description'] == existingInv['desc']4546 );4547 break;4548 case 'itc_rvsl': // GSTR24549 isFieldsMatch = (4550 iExInv['ITC Integrated Tax Amount'] == existingInv['iamt'] && iExInv['ITC Central Tax Amount'] == existingInv['camt'] &&4551 iExInv['ITC State/UT Tax Amount'] == existingInv['samt'] &&4552 iExInv['ITC Cess Amount'] == existingInv['csamt']);4553 break4554 case 'atadj': // GSTR24555 isFieldsMatch = (iExInv['Place Of Supply'].slice(0, 2) == existingInv['pos'] &&4556 iExInv['Supply Type'] == existingInv['sply_ty']);4557 break;4558 case 'nil': // GSTR24559 isFieldsMatch = (4560 iExInv['Description'] == existingInv['sply_ty'] &&4561 iExInv['Nil Rated Supplies'] == existingInv['nil_amt'] &&4562 iExInv['Exempted (other than nil rated/non GST supply )'] == existingInv['expt_amt'] &&4563 iExInv['Non-GST supplies'] == existingInv['ngsup_amt']4564 );4565 break;4566 }4567 }4568 return (isFieldsMatch);4569}4570//validate revised date with org date (should be greater)4571function validateLessShipOrInvDate(sbdtOrOdt, idtOrRevdt) {4572 var dateFormat = "DD/MM/YYYY";4573 var isValidShibBlDt = (moment(sbdtOrOdt, dateFormat).isBefore(moment(idtOrRevdt, dateFormat))) ? false : true;4574 return isValidShibBlDt;4575}4576function validateLessThanInvDate(iExInv, iSecID, iForm) {4577 var isValidSbdt;4578 switch (iSecID) {4579 case 'exp':4580 isValidSbdt = validateLessShipOrInvDate(iExInv['Shipping Bill Date'], iExInv['Invoice date']);4581 break;4582 case 'expa':4583 isValidSbdt = validateLessShipOrInvDate(iExInv['Shipping Bill Date'], iExInv['Original Invoice date']) &&4584 validateLessShipOrInvDate(iExInv['Shipping Bill Date'], iExInv['Revised Invoice date']);4585 break;4586 // case 'b2ba':4587 // case 'b2cla':4588 // isValidSbdt = validateLessShipOrInvDate(iExInv['Revised Invoice date'], iExInv['Original Invoice date']);4589 // break;4590 case 'cdnr':4591 case 'cdnur':4592 isValidSbdt = validateLessShipOrInvDate(iExInv['Note/Refund Voucher date'], iExInv['Invoice/Advance Receipt date']);4593 break;4594 case 'cdnra':4595 case 'cdnura':4596 isValidSbdt = validateLessShipOrInvDate(iExInv['Revised Note/Refund Voucher date'], iExInv['Original Invoice/Advance Receipt date']) &&4597 validateLessShipOrInvDate(iExInv['Original Note/Refund Voucher date'], iExInv['Original Invoice/Advance Receipt date']);4598 break;4599 // validateLessShipOrInvDate(iExInv['Revised Note/Refund Voucher date'], iExInv['Original Note/Refund Voucher date']) &&4600 default:4601 isValidSbdt = true;4602 }4603 return isValidSbdt;4604}4605//To change date format dd-mmm-yy/yyyy to dd/mm/yy4606function getDateTime(datetoformat) {4607 datetoformat = datetoformat.split("-");4608 var day = datetoformat[0];4609 var month = datetoformat[1];4610 var year = datetoformat[2];4611 var mon;4612 if (day && day.length < 2) {4613 day = "0" + day;4614 }4615 switch (month) {4616 case "Jan":4617 case "jan":4618 mon = "01";4619 break;4620 case "Feb":4621 case "feb":4622 mon = "02";4623 break;4624 case "Mar":4625 case "mar":4626 mon = "03";4627 break;4628 case "Apr":4629 case "apr":4630 mon = "04";4631 break;4632 case "May":4633 case "may":4634 mon = "05";4635 break;4636 case "Jun":4637 case "jun":4638 mon = "06";4639 break;4640 case "Jul":4641 case "jul":4642 mon = "07";4643 break;4644 case "Aug":4645 case "aug":4646 mon = "08";4647 break;4648 case "Sep":4649 case 'sep':4650 mon = "09";4651 break;4652 case "Oct":4653 case "oct":4654 mon = "10";4655 break;4656 case "Nov":4657 case "nov":4658 mon = "11";4659 break;4660 default:4661 mon = "12";4662 }4663 // if (year && year.length == 2) {4664 // return day + "/" + mon + "/" + "20" + year;4665 // } else {4666 // return day + "/" + mon + "/" + year;4667 // }4668 if (year && year.length == 2) {4669 return day + "-" + mon + "-" + "20" + year;4670 } else {4671 return day + "-" + mon + "-" + year;4672 }4673}4674//validation of dates from excel4675function validateExcelDates(iExInv, iSecID, iForm, iMonthsList, iYearsList, isValidExcelDates) {4676 var isValidDt = false,4677 isValidData = false;4678 if (iForm === "GSTR1") {4679 switch (iSecID) {4680 case 'b2b':4681 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4682 isValidDt = validateDate(iExInv['Invoice date'], iMonthsList);4683 break;4684 case 'b2ba':4685 iExInv['Original Invoice date'] = getDateTime(iExInv['Original Invoice date']);4686 iExInv['Revised Invoice date'] = getDateTime(iExInv['Revised Invoice date']);4687 isValidDt = (validateDate(iExInv['Original Invoice date'], iMonthsList) && validateDate(iExInv['Revised Invoice date'], iMonthsList));4688 break;4689 case 'b2cl':4690 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4691 isValidDt = validateDate(iExInv['Invoice date'], iMonthsList);4692 break;4693 case 'b2cla':4694 iExInv['Original Invoice date'] = getDateTime(iExInv['Original Invoice date']);4695 iExInv['Revised Invoice date'] = getDateTime(iExInv['Revised Invoice date']);4696 isValidDt = (validateDate(iExInv['Original Invoice date'], iMonthsList) && validateDate(iExInv['Revised Invoice date'], iMonthsList));4697 break;4698 case 'at':4699 case 'atadj':4700 case 'b2cs':4701 //iExInv['Document date'] = true;//getDateTime(iExInv['Document date']);4702 isValidDt = true//validateDate(iExInv['Document date'], iMonthsList);4703 break;4704 case 'exp':4705 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4706 if (iExInv['Shipping Bill Date'])4707 iExInv['Shipping Bill Date'] = getDateTime(iExInv['Shipping Bill Date']);4708 isValidDt = (validateDate(iExInv['Invoice date'], iMonthsList) && validateDate(iExInv['Shipping Bill Date'], iMonthsList, true));4709 break;4710 case 'expa':4711 iExInv['Original Invoice date'] = getDateTime(iExInv['Original Invoice date']);4712 iExInv['Revised Invoice date'] = getDateTime(iExInv['Revised Invoice date']);4713 if (iExInv['Shipping Bill Date'])4714 iExInv['Shipping Bill Date'] = getDateTime(iExInv['Shipping Bill Date']);4715 isValidDt = (validateDate(iExInv['Original Invoice date'], iMonthsList) && validateDate(iExInv['Revised Invoice date'], iMonthsList) && validateDate(iExInv['Shipping Bill Date'], iMonthsList));4716 break;4717 case 'cdnr':4718 iExInv['Invoice/Advance Receipt date'] = getDateTime(iExInv['Invoice/Advance Receipt date']);4719 iExInv['Note/Refund Voucher date'] = getDateTime(iExInv['Note/Refund Voucher date']);4720 if (iExInv['Pre GST'] == 'Y') {4721 isValidDt = (!validateDate(iExInv['Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Note/Refund Voucher date'], iMonthsList));4722 } else {4723 isValidDt = (validateDate(iExInv['Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Note/Refund Voucher date'], iMonthsList));4724 }4725 break;4726 case 'cdnur':4727 iExInv['Invoice/Advance Receipt date'] = getDateTime(iExInv['Invoice/Advance Receipt date']);4728 iExInv['Note/Refund Voucher date'] = getDateTime(iExInv['Note/Refund Voucher date']);4729 if (iExInv['Pre GST'] == 'Y') {4730 isValidDt = (!validateDate(iExInv['Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Note/Refund Voucher date'], iMonthsList));4731 } else {4732 isValidDt = (validateDate(iExInv['Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Note/Refund Voucher date'], iMonthsList));4733 }4734 break;4735 case 'cdnra':4736 case 'cdnura':4737 iExInv['Original Invoice/Advance Receipt date'] = getDateTime(iExInv['Original Invoice/Advance Receipt date']);4738 iExInv['Original Note/Refund Voucher date'] = getDateTime(iExInv['Original Note/Refund Voucher date']);4739 iExInv['Revised Note/Refund Voucher date'] = getDateTime(iExInv['Revised Note/Refund Voucher date']);4740 // isValidDt = (validateDate(iExInv['Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Revised Note/Refund Voucher date'], iMonthsList));4741 if (iExInv['Pre GST'] == 'Y') {4742 isValidDt = (!validateDate(iExInv['Original Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Original Note/Refund Voucher date'], iMonthsList) && validateDate(iExInv['Revised Note/Refund Voucher date'], iMonthsList));4743 } else {4744 isValidDt = (validateDate(iExInv['Original Invoice/Advance Receipt date'], iMonthsList) && validateDate(iExInv['Original Note/Refund Voucher date'], iMonthsList) && validateDate(iExInv['Revised Note/Refund Voucher date'], iMonthsList));4745 }4746 break;4747 case 'ata':4748 case 'atadja':4749 case 'b2csa':4750 var curntYear = iExInv['Financial Year'],4751 curntMonth = iExInv['Original Month'];4752 isValidDt = isValidRtnPeriod(iYearsList, curntYear, curntMonth).isValidPeriod;4753 break;4754 // case 'b2csa':4755 // isValidDt = validateMonth(iExInv['Month']);4756 // break;4757 /*case 'atadj':4758 case 'atadja' :4759 iExInv['Document date'] = true;//getDateTime(iExInv['Document date']);4760 isValidDt = true;//validateDate(iExInv['Document date'], iMonthsList);*/4761 case 'hsn':4762 isValidDt = true;4763 break;4764 case 'nil':4765 isValidDt = true;4766 break;4767 case 'doc_issue':4768 isValidDt = true;4769 break;4770 }4771 } else if (iForm === "GSTR2") {4772 switch (iSecID) {4773 case 'b2b': // GSTR24774 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4775 isValidDt = validateDate(iExInv['Invoice date'], iMonthsList);4776 break;4777 case 'b2bur': // GSTR24778 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4779 isValidDt = validateDate(iExInv['Invoice date'], iMonthsList);4780 break;4781 case 'b2ba': // GSTR24782 case 'b2bura': // GSTR24783 iExInv['Revised Invoice date'] = getDateTime(iExInv['Revised Invoice date']);4784 iExInv['Original Invoice date'] = getDateTime(iExInv['Original Invoice date']);4785 isValidDt = validateDate(iExInv['Original Invoice date'], iMonthsList) && validateDate(iExInv['Revised Invoice date'], iMonthsList);4786 break;4787 case 'cdnr': // GSTR24788 iExInv['Invoice/Advance Payment Voucher date'] = getDateTime(iExInv['Invoice/Advance Payment Voucher date']);4789 iExInv['Note/Refund Voucher date'] = getDateTime(iExInv['Note/Refund Voucher date']);4790 if (iExInv['Pre GST'] == 'Y') {4791 isValidDt = (!validateDate(iExInv['Invoice/Advance Payment Voucher date'], iMonthsList)) && (validateDate(iExInv['Note/Refund Voucher date'], iMonthsList));4792 } else {4793 isValidDt = validateDate(iExInv['Invoice/Advance Payment Voucher date'], iMonthsList) && validateDate(iExInv['Note/Refund Voucher date'], iMonthsList);4794 }4795 break;4796 case 'cdnur': // GSTR24797 iExInv['Invoice/Advance Payment Voucher date'] = getDateTime(iExInv['Invoice/Advance Payment Voucher date']);4798 iExInv['Note/Voucher date'] = getDateTime(iExInv['Note/Voucher date']);4799 if (iExInv['Pre GST'] == 'Y') {4800 isValidDt = (!validateDate(iExInv['Invoice/Advance Payment Voucher date'], iMonthsList)) && (validateDate(iExInv['Note/Voucher date'], iMonthsList));4801 } else {4802 isValidDt = validateDate(iExInv['Invoice/Advance Payment Voucher date'], iMonthsList) && validateDate(iExInv['Note/Voucher date'], iMonthsList);4803 }4804 break;4805 case 'cdnra': // GSTR24806 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4807 iExInv['Revised Debit Note date'] = getDateTime(iExInv['Revised Debit Note date']);4808 iExInv['Original Debit Note date'] = getDateTime(iExInv['Original Debit Note date']);4809 isValidDt = validateDate(iExInv['Invoice date'], iMonthsList) && validateDate(iExInv['Original Debit Note date'], iMonthsList) && validateDate(iExInv['Revised Debit Note date'], iMonthsList);4810 break;4811 case 'imp_g': // GSTR24812 iExInv['Bill Of Entry Date'] = getDateTime(iExInv['Bill Of Entry Date']);4813 isValidDt = validateDate(iExInv['Bill Of Entry Date'], iMonthsList);4814 break;4815 case 'imp_ga': // GSTR24816 iExInv['Original Bill Of Entry date'] = getDateTime(iExInv['Original Bill Of Entry date']);4817 iExInv['Revised Bill Of Entry date'] = getDateTime(iExInv['Revised Bill Of Entry date']);4818 isValidDt = validateDate(iExInv['Original Bill Of Entry date'], iMonthsList) && validateDate(iExInv['Revised Bill Of Entry date'], iMonthsList);4819 break;4820 case 'imp_s':4821 if (iExInv.hasOwnProperty('Invoice date')) {4822 iExInv['Invoice date'] = getDateTime(iExInv['Invoice date']);4823 isValidDt = validateDate(iExInv['Invoice date'], iMonthsList);4824 } else {4825 iExInv['Invoice Date'] = getDateTime(iExInv['Invoice Date']);4826 isValidDt = validateDate(iExInv['Invoice Date'], iMonthsList);4827 }4828 break;4829 case 'imp_sa': // GSTR24830 iExInv['Original Invoice date'] = getDateTime(iExInv['Original Invoice date']);4831 iExInv['Revised Invoice date'] = getDateTime(iExInv['Revised Invoice date']);4832 isValidDt = validateDate(iExInv['Revised Invoice date'], iMonthsList) && validateDate(iExInv['Revised Invoice date'], iMonthsList);4833 break;4834 case 'txi': // GSTR24835 iExInv['Document date'] = true;//getDateTime(iExInv['Document date']);4836 isValidDt = true//validateDate(iExInv['Document date'], iMonthsList);4837 break;4838 case 'atxi': // GSTR24839 iExInv['Original Document date'] = getDateTime(iExInv['Original Document date']);4840 iExInv['Revised Document date'] = getDateTime(iExInv['Revised Document date']);4841 isValidDt = validateDate(iExInv['Original Document date'], iMonthsList) && validateDate(iExInv['Revised Document date'], iMonthsList);4842 break;4843 case 'atadj': // GSTR24844 iExInv['Document date'] = true;4845 isValidDt = true;4846 break;4847 case 'hsnsum': // GSTR24848 case 'itc_rvsl': // GSTR24849 case 'nil': // GSTR24850 isValidDt = true;4851 break;4852 }4853 }4854 return (isValidDt);4855}4856//To check rates a/c to supplytype(in case of exp/expa withoutpayment values should be 0)4857function validateRates(iInv, iType, iSecId) {4858 return true;4859 var isValid = false;4860 if (iType) {4861 if (iType.name === "Intra-State") {4862 // if (iInv['IGST Rate'] == 0 && iInv['IGST Amount'] == 0) {4863 if (iInv['Rate'] == 0) {4864 isValid = true;4865 }4866 } else {4867 // if (iInv['CGST Rate'] == 0 && iInv['CGST Amount'] == 0 && iInv['SGST Rate'] == 0 && iInv['SGST Amount'] == 0) {4868 if (iInv['Rate'] == 0 /* && iInv['CGST Amount'] == 0 && iInv['SGST Rate'] == 0 && iInv['SGST Amount'] == 0*/) {4869 isValid = true;4870 }4871 }4872 }4873 if (iSecId == "exp" || iSecId == "expa")4874 if (iInv["Export Type"] == "WOPAY") {4875 if (iInv['Rate'] == 0) {4876 isValid = true;4877 } else {4878 isValid = false;4879 }4880 } else {4881 if (iInv['Rate'] == 0) {4882 isValid = true;4883 } else {4884 isValid = false;4885 }4886 }4887 return isValid;4888}4889//To check rates a/c to supplytype(in case of exp/expa withoutpayment values should be 0)4890function validateExcelTaxRates(iInv, iSecId, iSpLs, iForm) {4891 var isValidTaxRates = false;4892 suplyTyp = null;4893 if (iForm == "GSTR1") {4894 switch (iSecId) {4895 case 'b2b':4896 case 'b2ba':4897 suplyTyp = getSupplyType(iSpLs, iInv["GSTIN/UIN of Recipient"], (iInv["Place Of Supply"]).substring(0, 2));4898 isValidTaxRates = validateRates(iInv, suplyTyp);4899 break;4900 case 'b2cl':4901 case 'b2cla':4902 var gstin = (thisShareData.dashBoardDt.gstin).slice(0, 2),4903 pos,4904 suplyTyp;4905 if (iSecId == 'b2cla') {4906 pos = iInv["Original Place Of Supply"]4907 } else {4908 pos = iInv["Place Of Supply"]4909 }4910 if (pos) {4911 if (gstin === pos) {4912 suplyTyp = iSpLs[1];4913 } else {4914 suplyTyp = iSpLs[1];4915 }4916 }4917 //suplyTyp = getSupplyType(iSpLs, thisShareData.dashBoardDt.gstin, iInv["Place Of Supply"]);4918 // suplyTyp = iSpLs[1];4919 isValidTaxRates = validateRates(iInv, suplyTyp);4920 break;4921 case "b2cs":4922 //case "b2csa":4923 case "cdnr":4924 case "cdnra":4925 case "cdnur":4926 suplyTyp = getSupplyType(iSpLs, thisShareData.dashBoardDt.gstin, iInv["Place Of Supply"]);4927 isValidTaxRates = validateRates(iInv, suplyTyp);4928 break;4929 case "b2csa":4930 suplyTyp = getSupplyType(iSpLs, thisShareData.dashBoardDt.gstin, iInv["Original Place Of Supply"]);4931 isValidTaxRates = validateRates(iInv, suplyTyp);4932 break;4933 case "atadj":4934 suplyTyp = getSupplyType(iSpLs, iInv["Supplier's GSTIN/Name"], iInv["Recipient State Code"]);4935 isValidTaxRates = true;//validateRates(iInv, suplyTyp);4936 break;4937 case "at":4938 suplyTyp = getSupplyType(iSpLs, iInv["Supplier's GSTIN/Name"], iInv["Recipient State Code"]);4939 isValidTaxRates = true;//validateRates(iInv, suplyTyp);4940 break;4941 case "ata":4942 suplyTyp = getSupplyType(iSpLs, iInv["Revised Customer GSTIN/UIN/Name"], iInv["Recipient State Code"]);4943 isValidTaxRates = validateRates(iInv, suplyTyp);4944 break;4945 case 'exp':4946 case 'expa':4947 isValidTaxRates = validateRates(iInv, null, iSecId);4948 break;4949 case 'hsn':4950 isValidTaxRates = validateRates(iInv, null, iSecId);4951 break;4952 case 'nil':4953 isValidTaxRates = validateRates(iInv, null, iSecId);4954 break;4955 }4956 } else if (iForm == "GSTR2") {4957 switch (iSecId) {4958 case 'b2b': // GSTR24959 case 'b2ba': // GSTR24960 suplyTyp = getSupplyType(iSpLs, iInv["Supplier GSTIN"], iInv["Place Of Supply"]);4961 isValidTaxRates = validateRates(iInv, suplyTyp);4962 break;4963 case 'b2bur': // GSTR24964 case 'b2bura': // GSTR24965 // console.log(iInv["Supply Type"])4966 suplyTyp = iInv["Supply Type"];4967 isValidTaxRates = validateRates(iInv, suplyTyp);4968 break;4969 case "cdnr": // GSTR24970 case "cdnra": // GSTR24971 case "cdnur": // GSTR24972 suplyTyp = iInv["Supply Type"];4973 isValidTaxRates = validateRates(iInv, suplyTyp);4974 break;4975 case 'imp_g': // GSTR24976 case 'imp_ga': // GSTR24977 case 'imp_s': // GSTR24978 case 'imp_sa': // GSTR24979 // suplyTyp =iSpLs[1];4980 isValidTaxRates = true;4981 break;4982 case 'txi': // GSTR24983 suplyTyp = R1Util.getSupplyType(iSpLs, shareData.dashBoardDt.gstin, iInv["Place of Supply"]);4984 // suplyTyp = R1Util.getSupplyType(iSpLs, iInv["Supplier's GSTIN/Name"], iInv["Recipient State Code"]);4985 isValidTaxRates = true;//validateRates(iInv, suplyTyp);4986 break;4987 case 'atxi': // GSTR24988 suplyTyp = getSupplyType(iSpLs, iInv['Revised Supplier GSTIN'], iInv["Recipient State Code"]);4989 isValidTaxRates = validateRates(iInv, suplyTyp);4990 break;4991 case 'hsnsum': // GSTR24992 isValidTaxRates = validateRates(iInv, null, iSecId);4993 break;4994 case 'itc_rsvl': // GSTR24995 suplyTyp = getSupplyType(iSpLs, iInv['Supplier GSTIN']);4996 isValidTaxRates = validateRates(iInv, suplyTyp);4997 break;4998 case 'atadj': // GSTR24999 suplyTyp = R1Util.getSupplyType(iSpLs, shareData.dashBoardDt.gstin, iInv["Place of Supply"]);5000 isValidTaxRates = true;//validateRates(iInv, suplyTyp);5001 break;5002 }5003 }5004 return isValidTaxRates;5005}5006function getSupplyType(suplyList, ctin, pos, sup_ty, isSEZ) {5007 var rtObj = null,5008 gstin = (thisShareData.dashBoardDt.gstin).slice(0, 2);5009 if (thisShareData.dashBoardDt.form == "GSTR1") {5010 if (pos) {5011 if (isSEZ) {5012 rtObj = suplyList[1];5013 }5014 else {5015 if (gstin === pos) {5016 rtObj = suplyList[0];5017 } else {5018 rtObj = suplyList[1];5019 }5020 }5021 } else if (ctin) {5022 var ctinPos = (ctin).slice(0, 2);5023 if (isSEZ) {5024 rtObj = suplyList[1];5025 }5026 else {5027 if (gstin === ctinPos) {5028 rtObj = suplyList[0];5029 } else {5030 rtObj = suplyList[1];5031 }5032 }5033 }5034 // FIX DEFECT: 5957 AND 59545035 if (!isSEZ && (sup_ty == 'SEWP' || sup_ty == 'SEWOP')) {5036 rtObj = suplyList[1];5037 }5038 } else {5039 if (ctin && pos) {5040 var ctinPos = ctin.slice(0, 2);5041 if (ctinPos == pos) {5042 rtObj = suplyList[0];5043 } else {5044 rtObj = suplyList[1];5045 }5046 } else if (sup_ty) {5047 if (sup_ty === "IRAP") {5048 rtObj = suplyList[0];5049 } else {5050 rtObj = suplyList[1];5051 }5052 } else if (thisShareData.dashBoardDt.gstin) {5053 var gstin = thisShareData.dashBoardDt.gstin.slice(0, 2);5054 if (pos) {5055 if (gstin === pos) {5056 rtObj = suplyList[0];5057 } else {5058 rtObj = suplyList[1];5059 }5060 } else if (ctin) {5061 var ctinPos = (ctin).slice(0, 2);5062 if (gstin === ctinPos) {5063 rtObj = suplyList[0];5064 } else {5065 rtObj = suplyList[1];5066 }5067 }5068 }5069 }5070 return rtObj;5071}5072//To check mandatory fields n regex patterns for fields from excel5073function validatePattern(iString, isMandatory, iPattern, isPos) {5074 var isValid = false;5075 if (iString != null && iString !== "") {5076 isValid = isMandatory ? true : true;5077 if (iPattern) {5078 var patt = new RegExp(iPattern),5079 isPatternValid = false;5080 isPatternValid = patt.test(iString);5081 isValid = isValid && isPatternValid ? true : false;5082 }5083 if (isPos) {5084 var pos0to37 = (parseInt(iString) >= 1 && parseInt(iString) <= 37),5085 pos97 = (parseInt(iString) == 97);5086 isValid = (pos0to37 || pos97) ? true : false;5087 }...

Full Screen

Full Screen

returnStructure.js

Source:returnStructure.js Github

copy

Full Screen

...1472 // if (!iInv[impconst.diff_prcnt]) {1473 // iInv[impconst.diff_prcnt] = 100;1474 // }1475 isPttnMthced = (1476 validatePattern(iInv[impconst.pos], true, null, true) &&1477 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1478 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1479 //((validateGSTIN(iInv[impconst.ctin_pan_sup], iForm) &&1480 (validatePattern(iInv[impconst.ctin_pan_sup], true, null, false) || validatePattern(iInv[impconst.ctin_pan_sup], true, null, false)) &&1481 //validatePattern(iInv[impconst.trade_name], false, impconst.trade_name_ptrn,false) && 1482 validatePattern(iInv[impconst.rate], true, null, false) &&1483 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1484 //validatePattern(iInv[impconst.supplier_typ], true, null,false) &&1485 validatePattern(iInv[impconst.sup_cov_sec7], true, null, false)1486 //(iInv[impconst.hsn_opt]?validateExcel.validateHSN(iInv[impconst.hsn_opt]):true)1487 );1488 break;1489 case 'B2C':1490 // if (!iInv[impconst.diff_prcnt]) {1491 // iInv[impconst.diff_prcnt] = 100;1492 // }1493 isPttnMthced = (1494 validatePattern(iInv[impconst.pos], true, null, true) &&1495 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1496 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1497 validatePattern(iInv[impconst.rate], true, null, false) &&1498 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1499 validatePattern(iInv[impconst.sup_cov_sec7], true, null, false)1500 );1501 break;1502 case 'B2B':1503 // if (!iInv[impconst.diff_prcnt]) {1504 // iInv[impconst.diff_prcnt] = 100;1505 // }1506 isPttnMthced = (1507 validatePattern(iInv[impconst.pos], true, null, true) &&1508 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1509 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1510 //validateGSTIN(iInv[impconst.ctin_uin_rec], iForm) &&1511 validatePattern(iInv[impconst.ctin_uin_rec], true, null, false) &&1512 //validatePattern(iInv[impconst.trade_name], false, impconst.trade_name_ptrn,false) && 1513 validatePattern(iInv[impconst.rate], true, null, false) &&1514 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1515 validatePattern(iInv[impconst.doc_type], true, null, false) &&1516 validatePattern(iInv[impconst.doc_num], true, null, false) &&1517 validatePattern(iInv[impconst.doc_date], true, null, false) &&1518 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1519 validatePattern(iInv[impconst.doc_val], true, null, false) &&1520 validatePattern(iInv[impconst.sup_cov_sec7], true, null, false)1521 //validateExcel.validateHSN(iInv[impconst.hsn_opt])1522 );1523 break;1524 case 'EXP':1525 isPttnMthced = (1526 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1527 validatePattern(iInv[impconst.rate], true, null, false) &&1528 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1529 validatePattern(iInv[impconst.doc_type], true, null, false) &&1530 validatePattern(iInv[impconst.doc_num], true, null, false) &&1531 validatePattern(iInv[impconst.doc_val], true, null, false) &&1532 validatePattern(iInv[impconst.ship_num], false, null, false) &&1533 validatePattern(iInv[impconst.exp_typ], true, null, false) &&1534 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1535 validatePattern(iInv[impconst.doc_date], true, null, false) &&1536 //validateExcel.checkDocumentDate(iInv[impconst.ship_date],rtn_prd)&&1537 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1538 validatePattern(iInv[impconst.pcode_opt], false, null, false)1539 && validateShippingDetailsCombo(iInv[impconst.ship_date], iInv[impconst.pcode_opt], iInv[impconst.ship_num])1540 );1541 break;1542 case 'SEZ':1543 // if (!iInv[impconst.diff_prcnt]) {1544 // iInv[impconst.diff_prcnt] = 100;1545 // }1546 isPttnMthced = (1547 validatePattern(iInv[impconst.pos], true, null, true) &&1548 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1549 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1550 //validateGSTIN(iInv[impconst.ctin_rec], iForm) &&1551 validatePattern(iInv[impconst.ctin_rec], true, null, false) &&1552 //validatePattern(iInv[impconst.trade_name], false, impconst.trade_name_ptrn,false) && 1553 validatePattern(iInv[impconst.rate], true, null, false) &&1554 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1555 validatePattern(iInv[impconst.doc_date], true, null, false) &&1556 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1557 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1558 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1559 validatePattern(iInv[impconst.doc_type], true, null, false) &&1560 validatePattern(iInv[impconst.doc_num], true, null, false) &&1561 validatePattern(iInv[impconst.doc_val], true, null, false) &&1562 validatePattern(iInv[impconst.gst_pay_typ], true, null, false) &&1563 validatePattern(iInv[impconst.clm_rfnd], true, null, false)1564 );1565 break;1566 case 'DE':1567 // if (!iInv[impconst.diff_prcnt]) {1568 // iInv[impconst.diff_prcnt] = 100;1569 // }1570 isPttnMthced = (1571 validatePattern(iInv[impconst.pos], true, null, true) &&1572 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1573 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1574 //validateGSTIN(iInv[impconst.ctin_rec], iForm) &&1575 validatePattern(iInv[impconst.ctin_rec], true, null, false) &&1576 //validatePattern(iInv[impconst.trade_name], false, impconst.trade_name_ptrn,false) && 1577 validatePattern(iInv[impconst.rate], true, null, false) &&1578 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1579 validatePattern(iInv[impconst.doc_date], true, null, false) &&1580 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1581 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1582 validatePattern(iInv[impconst.doc_type], true, null, false) &&1583 validatePattern(iInv[impconst.doc_num], true, null, false) &&1584 validatePattern(iInv[impconst.doc_val], true, null, false) &&1585 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1586 validatePattern(iInv[impconst.clm_rfnd], true, null, false)1587 );1588 break;1589 case 'IMPS':1590 isPttnMthced = (1591 validatePattern(iInv[impconst.pos], true, null, true) &&1592 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1593 validatePattern(iInv[impconst.rate], true, null, false) &&1594 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1595 validatePattern(iInv[impconst.hsn_mand], true, null, false)1596 //validateExcel.validateHSN(iInv[impconst.hsn_mand])1597 );1598 break;1599 case 'IMPG':1600 isPttnMthced = (1601 validatePattern(iInv[impconst.pos], true, null, true) &&1602 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1603 validatePattern(iInv[impconst.rate], true, null, false) &&1604 validatePattern(cnvt2Nm(iInv[impconst.cess_paid]), false, null, false) &&1605 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1606 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1607 validatePattern(iInv[impconst.pcode_mand], true, null, false) &&1608 validatePattern(iInv[impconst.boe_num], true, null, false) &&1609 //validateExcel.checkDocumentDate(iInv[impconst.boe_date],rtn_prd)&&1610 validatePattern(iInv[impconst.boe_date], true, null, false) &&1611 validatePattern(iInv[impconst.boe_val], true, null, false) &&1612 validatePattern(iInv[impconst.doc_type], true, null, false)1613 );1614 break;1615 case 'IMPGSEZ':1616 isPttnMthced = (1617 //validateGSTIN(iInv[impconst.ctin_sup], iForm) &&1618 validatePattern(iInv[impconst.ctin_sup], true, null, false) &&1619 validatePattern(iInv[impconst.pos], true, null, true) &&1620 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1621 validatePattern(iInv[impconst.rate], true, null, false) &&1622 validatePattern(cnvt2Nm(iInv[impconst.cess_paid]), false, null, false) &&1623 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1624 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1625 validatePattern(iInv[impconst.pcode_mand], true, null, false) &&1626 validatePattern(iInv[impconst.boe_num], true, null, false) &&1627 validatePattern(iInv[impconst.boe_date], true, null, false) &&1628 //validateExcel.checkDocumentDate(iInv[impconst.boe_date],rtn_prd)&&1629 validatePattern(iInv[impconst.boe_val], true, null, false) &&1630 validatePattern(iInv[impconst.doc_type], true, null, false)1631 );1632 break;1633 case 'MIS':1634 // if (!iInv[impconst.diff_prcnt]) {1635 // iInv[impconst.diff_prcnt] = 100;1636 // }1637 isPttnMthced = (1638 validatePattern(iInv[impconst.pos], true, null, true) &&1639 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1640 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1641 //validateGSTIN(iInv[impconst.ctin_sup], iForm) &&1642 validatePattern(iInv[impconst.ctin_sup], true, null, false) &&1643 validatePattern(iInv[impconst.sup_eligible_clm_rfnd], true, null, false) &&1644 //validatePattern(iInv[impconst.trade_name], false, impconst.trade_name_ptrn,false) && 1645 validatePattern(iInv[impconst.rate], true, null, false) &&1646 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1647 validatePattern(iInv[impconst.doc_date], true, null, false) &&1648 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1649 validatePattern(iInv[impconst.doc_type], true, null, false) &&1650 validatePattern(iInv[impconst.doc_num], true, null, false) &&1651 validatePattern(iInv[impconst.doc_val], true, null, false) &&1652 (iInv[impconst.supply_related_to] !== '3B (B2B)') ? validatePattern(iInv[impconst.hsn_mand], true, null, false) : validatePattern(iInv[impconst.hsn_mand], false, null, false)1653 //validateExcel.validateHSN(iInv[impconst.hsn_opt])1654 );1655 break;1656 case 'ECOM':1657 isPttnMthced = (1658 //validateExcel.validateEcomGSTIN(iInv[impconst.ctin_ecom]) &&1659 validatePattern(iInv[impconst.ctin_ecom], true, null, false) &&1660 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1661 validatePattern(iInv[impconst.val_of_sup], true, null, false) &&1662 validatePattern(iInv[impconst.val_of_ret], true, null, false)1663 );1664 break;1665 case 'B2BAO':1666 //console.log("iInv vheck",iInv)1667 isPttnMthced = (1668 validatePattern(iInv[impconst.org_ctin_uin_rec], true, null, false) &&1669 validatePattern(iInv[impconst.org_doc_type], true, null, false) &&1670 validatePattern(iInv[impconst.org_doc_num], true, null, false) &&1671 validatePattern(iInv[impconst.org_doc_date], true, null, false) &&1672 validatePattern(iInv[impconst.rev_ctin_uin_rec], true, null, false) &&1673 validatePattern(iInv[impconst.rev_doc_type], true, null, false) &&1674 validatePattern(iInv[impconst.rev_doc_num], true, null, false) &&1675 validatePattern(iInv[impconst.rev_doc_date], true, null, false) &&1676 validatePattern(iInv[impconst.doc_val], true, null, false) &&1677 validatePattern(iInv[impconst.pos], true, null, true) &&1678 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1679 validatePattern(iInv[impconst.sup_cov_sec7], true, null, false) &&1680 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1681 validatePattern(iInv[impconst.rate], true, null, false) &&1682 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false)1683 );1684 break;1685 }1686 // console.log("isPttnMthced", isPttnMthced)1687 }1688 else if (iForm == "ANX1A") {1689 switch (iSecId) {1690 case 'REVA':1691 let panSupCheck = false;1692 if(iInv[impconst.ctin_pan_sup].length == 10){1693 panSupCheck = true;1694 }1695 1696 if (!iInv[impconst.diff_prcnt]) {1697 iInv[impconst.diff_prcnt] = 100;1698 }1699 isPttnMthced = (1700 checkForMandatory(iInv[impconst.pos]) &&1701 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1702 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1703 //((validateGSTIN(iInv[impconst.ctin_pan_sup], iForm) &&1704 (validatePattern(iInv[impconst.ctin_pan_sup], true, null, false) || validatePattern(iInv[impconst.ctin_pan_sup], true, null, false)) &&1705 //validatePattern(iInv[impconst.trade_name], false, impconst.trade_name_ptrn,false) && 1706 validatePattern(iInv[impconst.rate], true, null, false) &&1707 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1708 // validatePattern(iInv[impconst.supplier_typ], true, null,false) &&1709 validatePattern(iInv[impconst.sup_cov_sec7], true, null, false)1710 //(iInv[impconst.hsn_opt]?validateExcel.validateHSN(iInv[impconst.hsn_opt]):true)1711 );1712 if(panSupCheck == true) {1713 isPttnMthced = isPttnMthced && checkForMandatory(iInv[impconst.sup_typ]); 1714 }1715 break;1716 case 'B2CA':1717 isPttnMthced = (1718 checkForMandatory(iInv[impconst.pos]) &&1719 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1720 validatePattern(iInv[impconst.diff_prcnt], true, null, false) &&1721 validatePattern(iInv[impconst.rate], true, null, false) &&1722 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1723 validatePattern(iInv[impconst.sup_cov_sec7], true, null, false)1724 );1725 break;1726 case 'EXPA':1727 if (iInv[impconst.doc_type + '_1']) {1728 isPttnMthced = (1729 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1730 validatePattern(iInv[impconst.rate], true, null, false) &&1731 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1732 validatePattern(iInv[impconst.doc_type + '_1'], true, null, false) &&1733 validatePattern(iInv[impconst.doc_num + '_1'], true, null, false) &&1734 validatePattern(iInv[impconst.doc_val], true, null, false) &&1735 validatePattern(iInv[impconst.ship_num], false, null, false) &&1736 validatePattern(iInv[impconst.exp_typ], true, null, false) &&1737 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1738 validatePattern(iInv[impconst.doc_date + '_1'], true, null, false) &&1739 //validateExcel.checkDocumentDate(iInv[impconst.ship_date],rtn_prd)&&1740 // validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1741 validatePattern(iInv[impconst.hsn_mand],true, null, false)&&1742 validatePattern(iInv[impconst.pcode_opt], false, null, false) &&1743 validatePattern(iInv[impconst.doc_type], true, null, false) &&1744 validatePattern(iInv[impconst.doc_num], true, null, false) &&1745 validatePattern(iInv[impconst.doc_date], true, null, false) &&1746 validateShippingDetailsCombo(iInv[impconst.ship_date], iInv[impconst.pcode_opt], iInv[impconst.ship_num]))1747 } else {1748 isPttnMthced = (1749 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1750 validatePattern(iInv[impconst.rate], true, null, false) &&1751 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1752 // validatePattern(iInv[impconst.doc_type], true, null, false) &&1753 validatePattern(iInv[impconst.rev_doc_type], true, null, false) &&1754 // validatePattern(iInv[impconst.doc_num], true, null, false) &&1755 validatePattern(iInv[impconst.rev_doc_num], true, null, false) &&1756 validatePattern(iInv[impconst.doc_val], true, null, false) &&1757 validatePattern(iInv[impconst.ship_num], false, null, false) &&1758 validatePattern(iInv[impconst.exp_typ], true, null, false) &&1759 //validateExcel.checkDocumentDate(iInv[impconst.doc_date],rtn_prd)&&1760 // validatePattern(iInv[impconst.doc_date], true, null, false) &&1761 validatePattern(iInv[impconst.rev_doc_date], true, null, false) &&1762 //validateExcel.checkDocumentDate(iInv[impconst.ship_date],rtn_prd)&&1763 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1764 validatePattern(iInv[impconst.hsn_mand],true, null, false)&&1765 validatePattern(iInv[impconst.pcode_opt], false, null, false) &&1766 validatePattern(iInv[impconst.odoc_type], true, null, false) &&1767 validatePattern(iInv[impconst.odoc_num], true, null, false) &&1768 validatePattern(iInv[impconst.odoc_date], true, null, false) &&1769 validateShippingDetailsCombo(iInv[impconst.ship_date], iInv[impconst.pcode_opt], iInv[impconst.ship_num])1770 );1771 }1772 break;1773 case 'IMPSA':1774 isPttnMthced = (1775 checkForMandatory(iInv[impconst.pos]) &&1776 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1777 validatePattern(iInv[impconst.rate], true, null, false) &&1778 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1779 validatePattern(iInv[impconst.hsn_mand], true, null, false)1780 //validateExcel.validateHSN(iInv[impconst.hsn_mand])1781 );1782 break;1783 case 'IMPGA':1784 if (iInv[impconst.doc_type + '_1']) {1785 isPttnMthced = (1786 checkForMandatory(iInv[impconst.pos]) &&1787 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1788 validatePattern(iInv[impconst.rate], true, null, false) &&1789 validatePattern(cnvt2Nm(iInv[impconst.cess_paid]), false, null, false) &&1790 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1791 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1792 validatePattern(iInv[impconst.pcode_mand + '_1'], true, null, false) &&1793 validatePattern(iInv[impconst.boe_num + '_1'], true, null, false) &&1794 //validateExcel.checkDocumentDate(iInv[impconst.boe_date],rtn_prd)&&1795 validatePattern(iInv[impconst.boe_date + '_1'], true, null, false) &&1796 validatePattern(iInv[impconst.boe_val], true, null, false) &&1797 validatePattern(iInv[impconst.doc_type + '_1'], true, null, false) &&1798 validatePattern(iInv[impconst.boe_num], true, null, false) &&1799 validatePattern(iInv[impconst.boe_date], true, null, false) &&1800 validatePattern(iInv[impconst.doc_type], true, null, false) &&1801 validatePattern(iInv[impconst.pcode_mand], true, null, false)1802 );1803 } else {1804 isPttnMthced = (1805 checkForMandatory(iInv[impconst.pos]) &&1806 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1807 validatePattern(iInv[impconst.rate], true, null, false) &&1808 validatePattern(cnvt2Nm(iInv[impconst.cess_paid]), false, null, false) &&1809 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1810 //validateExcel.validateHSN(iInv[impconst.hsn_mand])&&1811 // validatePattern(iInv[impconst.pcode_mand], true, null, false) &&1812 validatePattern(iInv[impconst.rev_pcode_mand], true, null, false) &&1813 // validatePattern(iInv[impconst.boe_num], true, null, false) &&1814 validatePattern(iInv[impconst.rev_boe_num], true, null, false) &&1815 //validateExcel.checkDocumentDate(iInv[impconst.boe_date],rtn_prd)&&1816 // validatePattern(iInv[impconst.boe_date], true, null, false) &&1817 validatePattern(iInv[impconst.rev_boe_date], true, null, false) &&1818 validatePattern(iInv[impconst.boe_val], true, null, false) &&1819 // validatePattern(iInv[impconst.doc_type], true, null, false) &&1820 validatePattern(iInv[impconst.rev_doc_type], true, null, false) &&1821 validatePattern(iInv[impconst.oboe_num], true, null, false) &&1822 validatePattern(iInv[impconst.oboe_date], true, null, false) &&1823 validatePattern(iInv[impconst.odoc_type], true, null, false) &&1824 validatePattern(iInv[impconst.opcode_mand], true, null, false)1825 );1826 }1827 break;1828 case 'IMPGSEZA':1829 if (iInv[impconst.doc_type + '_1']) {1830 isPttnMthced = (1831 validatePattern(iInv[impconst.ctin_sup + '_1'], true, null, false) &&1832 checkForMandatory(iInv[impconst.pos]) &&1833 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1834 validatePattern(iInv[impconst.rate], true, null, false) &&1835 validatePattern(cnvt2Nm(iInv[impconst.cess_paid]), false, null, false) &&1836 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1837 validatePattern(iInv[impconst.pcode_mand + '_1'], true, null, false) &&1838 validatePattern(iInv[impconst.boe_num + '_1'], true, null, false) &&1839 validatePattern(iInv[impconst.boe_date + '_1'], true, null, false) &&1840 validatePattern(iInv[impconst.boe_val], true, null, false) &&1841 validatePattern(iInv[impconst.doc_type + '_1'], true, null, false) &&1842 validatePattern(iInv[impconst.ctin_sup], true, null, false) &&1843 validatePattern(iInv[impconst.pcode_mand], true, null, false) &&1844 validatePattern(iInv[impconst.boe_num], true, null, false) &&1845 validatePattern(iInv[impconst.boe_date], true, null, false) &&1846 validatePattern(iInv[impconst.doc_type], true, null, false)1847 );1848 } else {1849 isPttnMthced = (1850 // validatePattern(iInv[impconst.ctin_sup], true, null, false) &&1851 validatePattern(iInv[impconst.rev_ctin_sup], true, null, false) &&1852 checkForMandatory(iInv[impconst.pos]) &&1853 validatePattern(iInv[impconst.taxable_value], true, null, false) &&1854 validatePattern(iInv[impconst.rate], true, null, false) &&1855 validatePattern(cnvt2Nm(iInv[impconst.cess_paid]), false, null, false) &&1856 validatePattern(iInv[impconst.hsn_mand], true, null, false) &&1857 // validatePattern(iInv[impconst.pcode_mand], true, null, false) &&1858 validatePattern(iInv[impconst.rev_pcode_mand], true, null, false) &&1859 // validatePattern(iInv[impconst.boe_num], true, null, false) &&1860 validatePattern(iInv[impconst.rev_boe_num], true, null, false) &&1861 // validatePattern(iInv[impconst.boe_date], true, null, false) &&1862 validatePattern(iInv[impconst.rev_boe_date], true, null, false) &&1863 validatePattern(iInv[impconst.boe_val], true, null, false) &&1864 // validatePattern(iInv[impconst.doc_type], true, null, false) &&1865 validatePattern(iInv[impconst.rev_doc_type], true, null, false) &&1866 validatePattern(iInv[impconst.octin_sup], true, null, false) &&1867 validatePattern(iInv[impconst.opcode_mand], true, null, false) &&1868 validatePattern(iInv[impconst.oboe_num], true, null, false) &&1869 validatePattern(iInv[impconst.oboe_date], true, null, false) &&1870 validatePattern(iInv[impconst.odoc_type], true, null, false)1871 );1872 }1873 break;1874 case 'ECOMA':1875 isPttnMthced = (1876 //validateExcel.validateEcomGSTIN(iInv[impconst.ctin_ecom]) &&1877 validatePattern(iInv[impconst.ctin_ecom], true, null, false) &&1878 validatePattern(cnvt2Nm(iInv[impconst.cess]), false, null, false) &&1879 validatePattern(iInv[impconst.val_of_sup], true, null, false) &&1880 validatePattern(iInv[impconst.val_of_ret], true, null, false)1881 );1882 break;1883 }1884 }1885 logger.log("debug", "Exiting returnStructure.js:: validateExcelMandatoryFields :: %s", isPttnMthced);1886 return isPttnMthced;1887}1888//To check all values at invoice level inorder to add multi items from excel1889function validateInvoice(iForm, iSecID, iExInv, existingInv) {1890 logger.log("debug", "Entering returnStructure.js:: validateInvoice");1891 var isFieldsMatch = false;1892 if (iExInv[impconst.pos]) {1893 iExInv[impconst.pos] = (iExInv[impconst.pos]).substring(0, 2);1894 }1895 if (iForm === "ANX1") {1896 switch (iSecID) {1897 case 'REV':1898 isFieldsMatch = (1899 iExInv[impconst.ctin_pan_sup] == existingInv['ctin'] &&1900 iExInv[impconst.pos] == existingInv['pos'] &&1901 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == (existingInv['diffprcnt']).toFixed(2) &&1902 iExInv[impconst.sup_cov_sec7] == (existingInv['sec7act'] == 'Y' ? 'Yes' : 'No')1903 );1904 break;1905 case 'B2C':1906 isFieldsMatch = (1907 iExInv[impconst.pos] == existingInv['pos'] &&1908 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt'] &&1909 iExInv[impconst.sup_cov_sec7] == (existingInv['sec7act'] == 'Y' ? 'Yes' : 'No')1910 );1911 break;1912 case 'B2B':1913 isFieldsMatch = (1914 iExInv[impconst.ctin_uin_rec] == existingInv['ctin'] &&1915 iExInv[impconst.pos] == existingInv['pos'] &&1916 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt'] &&1917 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1918 (iExInv[impconst.doc_num]).toString() == existingInv.doc['num'] &&1919 (iExInv[impconst.doc_date]).toString() == existingInv.doc['dt'] &&1920 iExInv[impconst.doc_val] == existingInv.doc['val']1921 );1922 break;1923 case 'EXP':1924 isFieldsMatch = (1925 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1926 iExInv[impconst.exp_typ] == existingInv['exptype'] &&1927 (iExInv[impconst.doc_num]).toString() == existingInv.doc['num'] &&1928 (iExInv[impconst.doc_date]).toString() == existingInv.doc['dt'] &&1929 iExInv[impconst.doc_val] == existingInv.doc['val']1930 );1931 break;1932 case 'SEZ':1933 isFieldsMatch = (1934 iExInv[impconst.ctin_rec] == existingInv['ctin'] &&1935 iExInv[impconst.pos] == existingInv['pos'] &&1936 iExInv[impconst.gst_pay_typ] == existingInv['seztype'] &&1937 (existingInv['diffprcnt'] ? ((iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt']) : true) &&1938 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1939 (iExInv[impconst.doc_num]).toString() == existingInv.doc['num'] &&1940 (iExInv[impconst.doc_date]).toString() == existingInv.doc['dt'] &&1941 iExInv[impconst.doc_val] == existingInv.doc['val']1942 );1943 break;1944 case 'DE':1945 isFieldsMatch = (1946 iExInv[impconst.ctin_rec] == existingInv['ctin'] &&1947 iExInv[impconst.pos] == existingInv['pos'] &&1948 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt'] &&1949 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1950 (iExInv[impconst.doc_num]).toString() == existingInv.doc['num'] &&1951 (iExInv[impconst.doc_date]).toString() == existingInv.doc['dt'] &&1952 iExInv[impconst.doc_val] == existingInv.doc['val']1953 );1954 break;1955 case 'IMPS':1956 isFieldsMatch = (1957 iExInv[impconst.pos] == existingInv['pos']1958 );1959 break;1960 case 'IMPG':1961 isFieldsMatch = (1962 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1963 (iExInv[impconst.boe_num]).toString() == existingInv.boe['num'] &&1964 (iExInv[impconst.boe_date]).toString() == existingInv.boe['dt'] &&1965 iExInv[impconst.pos] == existingInv['pos'] &&1966 iExInv[impconst.boe_val] == existingInv.boe['val']1967 );1968 break;1969 case 'IMPGSEZ':1970 isFieldsMatch = (1971 iExInv[impconst.ctin_sup] == existingInv['ctin'] &&1972 iExInv[impconst.pos] == existingInv['pos'] &&1973 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1974 (iExInv[impconst.boe_num]).toString() == existingInv.boe['num'] &&1975 (iExInv[impconst.boe_date]).toString() == existingInv.boe['dt'] &&1976 iExInv[impconst.boe_val] == existingInv.boe['val']1977 );1978 break;1979 case 'MIS':1980 isFieldsMatch = (1981 iExInv[impconst.ctin_sup] == existingInv['ctin'] &&1982 iExInv[impconst.pos] == existingInv['pos'] &&1983 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt'] &&1984 getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&1985 getSecref(iExInv[impconst.supply_related_to]) == existingInv['tblref'] &&1986 (iExInv[impconst.doc_num]).toString() == existingInv.doc['num'] &&1987 (iExInv[impconst.doc_date]).toString() == existingInv.doc['dt'] &&1988 iExInv[impconst.doc_val] == existingInv.doc['val']1989 );1990 break; 1991 // case 'ECOM':1992 // isFieldsMatch = (1993 // iExInv[impconst.ctin_ecom] == existingInv['ctin']1994 // );1995 // break;1996 case 'B2BAO':1997 // console.log("isFieldsMatch rate ::", iExInv[impconst.rate],existingInv)1998 isFieldsMatch = (1999 iExInv[impconst.org_ctin_uin_rec] == existingInv['octin'] &&2000 iExInv[impconst.rev_ctin_uin_rec] == existingInv['ctin'] &&2001 iExInv[impconst.pos] == existingInv['pos'] &&2002 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt'] &&2003 getDoctype(iExInv[impconst.org_doc_type]) == existingInv['odoctyp'] &&2004 getDoctype(iExInv[impconst.rev_doc_type]) == existingInv['doctyp'] &&2005 (iExInv[impconst.org_doc_num]).toString() == existingInv.odoc['num'] &&2006 (iExInv[impconst.rev_doc_num]).toString() == existingInv.doc['num'] &&2007 (iExInv[impconst.org_doc_date]).toString() == existingInv.odoc['dt'] &&2008 (iExInv[impconst.rev_doc_date]).toString() == existingInv.doc['dt'] &&2009 (iExInv[impconst.rate]) != existingInv.items[0]['rate'] &&2010 iExInv[impconst.rev_doc_val] == existingInv.doc['val'] 2011 );2012 break;2013 }2014 } else if (iForm === "ANX1A") {2015 switch (iSecID) {2016 case 'REVA':2017 isFieldsMatch = (2018 iExInv[impconst.ctin_pan_sup] == existingInv['ctin'] &&2019 iExInv[impconst.pos] == existingInv['pos'] &&2020 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == (existingInv['diffprcnt']).toFixed(2) &&2021 iExInv[impconst.sup_cov_sec7] == (existingInv['sec7act'] == 'Y' ? 'Yes' : 'No')2022 );2023 break;2024 case 'B2CA':2025 isFieldsMatch = (2026 iExInv[impconst.pos] == existingInv['pos'] &&2027 (iExInv[impconst.diff_prcnt] / 100).toFixed(2) == existingInv['diffprcnt'] &&2028 iExInv[impconst.sup_cov_sec7] == (existingInv['sec7act'] == 'Y' ? 'Yes' : 'No')2029 );2030 break;2031 case 'EXPA':2032 if (iExInv[impconst.doc_type + '_1']) {2033 isFieldsMatch = (2034 getDoctype(iExInv[impconst.doc_type + '_1']) == existingInv['doctyp'] &&2035 iExInv[impconst.exp_typ] == existingInv['exptype'] &&2036 (iExInv[impconst.doc_num + '_1']).toString() == existingInv.doc['num'] &&2037 (iExInv[impconst.doc_date + '_1']).toString() == existingInv.doc['dt'] &&2038 iExInv[impconst.doc_val] == existingInv.doc['val'] &&2039 getDoctype(iExInv[impconst.doc_type]) == existingInv['odoctyp'] &&2040 (iExInv[impconst.doc_num]).toString() == existingInv.odoc['num'] &&2041 (iExInv[impconst.doc_date]).toString() == existingInv.odoc['dt']2042 );2043 } else {2044 isFieldsMatch = (2045 // getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&2046 getDoctype(iExInv[impconst.rev_doc_type]) == existingInv['doctyp'] &&2047 iExInv[impconst.exp_typ] == existingInv['exptype'] &&2048 // (iExInv[impconst.doc_num]).toString() == existingInv.doc['num'] &&2049 (iExInv[impconst.rev_doc_num]).toString() == existingInv.doc['num'] &&2050 // (iExInv[impconst.doc_date]).toString() == existingInv.doc['dt'] &&2051 (iExInv[impconst.rev_doc_date]).toString() == existingInv.doc['dt'] &&2052 iExInv[impconst.doc_val] == existingInv.doc['val'] &&2053 getDoctype(iExInv[impconst.odoc_type]) == existingInv['odoctyp'] &&2054 (iExInv[impconst.odoc_num]).toString() == existingInv.odoc['num'] &&2055 (iExInv[impconst.odoc_date]).toString() == existingInv.odoc['dt']2056 );2057 }2058 break;2059 case 'IMPSA':2060 isFieldsMatch = (2061 iExInv[impconst.pos] == existingInv['pos']2062 );2063 break;2064 case 'IMPGA':2065 if (iExInv[impconst.doc_type + '_1']) {2066 isFieldsMatch = (2067 getDoctype(iExInv[impconst.doc_type + '_1']) == existingInv['doctyp'] &&2068 (iExInv[impconst.boe_num + '_1']).toString() == existingInv.boe['num'] &&2069 (iExInv[impconst.boe_date + '_1']).toString() == existingInv.boe['dt'] &&2070 iExInv[impconst.pos] == existingInv['pos'] &&2071 iExInv[impconst.boe_val] == existingInv.boe['val'] &&2072 getDoctype(iExInv[impconst.doc_type]) == existingInv['odoctyp'] &&2073 (iExInv[impconst.boe_num]).toString() == existingInv.oboe['num'] &&2074 (iExInv[impconst.boe_date]).toString() == existingInv.oboe['dt']2075 );2076 } else {2077 isFieldsMatch = (2078 // getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&2079 getDoctype(iExInv[impconst.rev_doc_type]) == existingInv['doctyp'] &&2080 // (iExInv[impconst.boe_num]).toString() == existingInv.boe['num'] &&2081 (iExInv[impconst.rev_boe_num]).toString() == existingInv.boe['num'] &&2082 // (iExInv[impconst.boe_date]).toString() == existingInv.boe['dt'] &&2083 (iExInv[impconst.rev_boe_date]).toString() == existingInv.boe['dt'] &&2084 iExInv[impconst.pos] == existingInv['pos'] &&2085 iExInv[impconst.boe_val] == existingInv.boe['val'] &&2086 getDoctype(iExInv[impconst.odoc_type]) == existingInv['odoctyp'] &&2087 (iExInv[impconst.oboe_num]).toString() == existingInv.oboe['num'] &&2088 (iExInv[impconst.oboe_date]).toString() == existingInv.oboe['dt']2089 );2090 }2091 break;2092 case 'IMPGSEZA':2093 if (iExInv[impconst.doc_type + '_1']) {2094 isFieldsMatch = (2095 iExInv[impconst.ctin_sup + '_1'] == existingInv['ctin'] &&2096 iExInv[impconst.pos] == existingInv['pos'] &&2097 getDoctype(iExInv[impconst.doc_type + '_1']) == existingInv['doctyp'] &&2098 (iExInv[impconst.boe_num + '_1']).toString() == existingInv.boe['num'] &&2099 (iExInv[impconst.boe_date + '_1']).toString() == existingInv.boe['dt'] &&2100 iExInv[impconst.boe_val] == existingInv.boe['val'] &&2101 iExInv[impconst.ctin_sup] == existingInv['octin'] &&2102 getDoctype(iExInv[impconst.doc_type]) == existingInv['odoctyp'] &&2103 (iExInv[impconst.boe_num]).toString() == existingInv.oboe['num'] &&2104 (iExInv[impconst.boe_date]).toString() == existingInv.oboe['dt']2105 );2106 } else {2107 isFieldsMatch = (2108 // iExInv[impconst.ctin_sup] == existingInv['ctin'] &&2109 iExInv[impconst.rev_ctin_sup] == existingInv['ctin'] &&2110 iExInv[impconst.pos] == existingInv['pos'] &&2111 // getDoctype(iExInv[impconst.doc_type]) == existingInv['doctyp'] &&2112 getDoctype(iExInv[impconst.rev_doc_type]) == existingInv['doctyp'] &&2113 // (iExInv[impconst.boe_num]).toString() == existingInv.boe['num'] &&2114 (iExInv[impconst.rev_boe_num]).toString() == existingInv.boe['num'] &&2115 // (iExInv[impconst.boe_date]).toString() == existingInv.boe['dt'] &&2116 (iExInv[impconst.rev_boe_date]).toString() == existingInv.boe['dt'] &&2117 iExInv[impconst.boe_val] == existingInv.boe['val'] &&2118 iExInv[impconst.octin_sup] == existingInv['octin'] &&2119 getDoctype(iExInv[impconst.odoc_type]) == existingInv['odoctyp'] &&2120 (iExInv[impconst.oboe_num]).toString() == existingInv.oboe['num'] &&2121 (iExInv[impconst.oboe_date]).toString() == existingInv.oboe['dt']2122 );2123 }2124 break;2125 }2126 }2127 logger.log("debug", "Exiting returnStructure.js:: validateInvoice :%s :%s", isFieldsMatch, iSecID);2128 return isFieldsMatch;2129}2130function validateShippingDetailsCombo(sbDate, pcode, sbNum) {2131 if ((pcode == null || pcode == undefined) && (sbNum == null || sbNum == undefined) && (sbDate == null || sbDate == undefined)) {2132 return true;2133 }2134 if (sbDate && (pcode == null || pcode == undefined || sbNum == null || sbNum == undefined)) {2135 return false;2136 }2137 if (sbNum != null && sbNum != undefined && (pcode == null || pcode == undefined || sbDate == null || sbDate == undefined)) {2138 return false;2139 }2140 if (pcode != null && pcode != undefined && (sbNum == null || sbNum == undefined || sbDate == null || sbDate == undefined)) {2141 return false;2142 }2143 return true;2144}2145// This method has been modified to just check whether the field value is entered or not. Basically for Mandatory field check2146// Pattern check will be handled in schema and business validations2147function checkForMandatory(iString){2148 logger.log("debug", "Entering returnStructure.js:: checkForMandatory");2149 if (iString !== undefined && iString != null && iString !== "") {2150 return true; 2151 } else {2152 return false;2153 }2154}2155//This function takes the input string and regex pattern and returns boolean value2156function validatePattern(iString, isMandatory, iPattern, isPos) {2157 logger.log("debug", "Entering returnStructure.js:: validatePattern");2158 var isValid = false;2159 if (iString !== undefined && iString != null && iString !== "") {2160 isValid = true; //isMandatory ? true : true;2161 if (iPattern) {2162 var patt = new RegExp(iPattern),2163 isPatternValid = false;2164 isPatternValid = patt.test(iString);2165 isValid = isValid && isPatternValid ? true : false;2166 }2167 if (isPos) {2168 let pos = iString;2169 if (iString && iString.indexOf("-") > 0) {2170 pos = iString.split("-")[0];...

Full Screen

Full Screen

pattern.spec.js

Source:pattern.spec.js Github

copy

Full Screen

...103 };104 });105 describe('valid patterns', function() {106 it('should validate universal pattern', function() {107 validatePattern('*://*/*?*#*', true);108 });109 it('should validate pattern with empty path', function() {110 validatePattern('*://*/', true);111 });112 it('should validate pattern with just scheme, host and path', function() {113 validatePattern('*://*/*', true);114 validatePattern('http://aaa.bbb/ccc', true);115 });116 it('should validate pattern with params', function() {117 validatePattern('*://*/*?aaa=bbb', true);118 });119 it('should validate pattern with fragment', function() {120 validatePattern('*://*/*#aaa', true);121 });122 it('should validate full pattern', function() {123 validatePattern('*://*/*?*#*', true);124 validatePattern(complex_url, true);125 });126 });127 describe('incomplete patterns', function() {128 it('should not validate pattern without scheme', function() {129 validatePattern('*/*', false);130 validatePattern('://*/*', false);131 validatePattern('://aaa.bbb/', false);132 validatePattern('aaa.bbb/', false);133 });134 it('should not validate pattern without host', function() {135 validatePattern('*:///*', false);136 validatePattern('http:///aaa', false);137 });138 });139 describe('invalid patterns', function() {140 it('should not validate pattern with invalid scheme', function() {141 validatePattern('http//*/*', false);142 validatePattern('http:/*/*', false);143 validatePattern('http:*/*', false);144 validatePattern('http*/*', false);145 });146 it('should not validate pattern with invalid host', function() {147 validatePattern('http://**/*', false);148 validatePattern('http://aaa*bbb/*', false);149 validatePattern('http://aaa.*/*', false);150 });151 it('should not validate pattern with invalid params', function() {152 validatePattern('*://*/*?aaa==bbb', false);153 validatePattern('*://*/*?aaa=bbb=ccc', false);154 validatePattern('*://*/*?=', false);155 });156 it('should not validate pattern with invalid fragment', function() {157 validatePattern('*://*/*##', false);158 validatePattern('*://*/*##aaa', false);159 validatePattern('*://*/*#aaa#', false);160 validatePattern('*://*/*#aaa#bbb', false);161 });162 });163 });164 describe('sanitize', function() {165 it('should convert single asterisk to universal match pattern', function() {166 pattern = new Pattern('*');167 expect(pattern.original_pattern).toEqual('*://*/*?*#*');168 });169 it('should convert `<all_urls>` to universal match pattern', function() {170 pattern = new Pattern('<all_urls>');171 expect(pattern.original_pattern).toEqual('*://*/*?*#*');172 });173 });174 describe('match', function() {...

Full Screen

Full Screen

aws-batch-trigger-validate.test.js

Source:aws-batch-trigger-validate.test.js Github

copy

Full Screen

...137 t.truthy(/^JD--[0-9T-]+--[0-9a-f]{32}$/.test(generateJobName({jobDefinition: 'JD'})));138});139test('validate simple unique pattern', t => {140 const pattern = 'myprefix-.*';141 t.truthy(validatePattern(pattern, 'myprefix-isgood'));142 t.truthy(validatePattern(pattern, 'myprefix-isOK'));143 t.truthy(validatePattern(pattern, 'myprefix-is-super-green'));144 t.falsy(validatePattern(pattern, 'myprefixalone'));145 t.falsy(validatePattern(pattern, 'not-myprefix-followed'));146 t.falsy(validatePattern(pattern, 'this-is-super-red'));147});148test('validate simple unique pattern bis', t => {149 const pattern = '(t[io])+';150 t.truthy(validatePattern(pattern, 'to'));151 t.truthy(validatePattern(pattern, 'toto'));152 t.truthy(validatePattern(pattern, 'titi'));153 t.falsy(validatePattern(pattern, 'tata'));154 t.falsy(validatePattern(pattern, 'atoto'));155 t.falsy(validatePattern(pattern, 'oto'));156});157test('validate multipattern', t => {158 const multipattern = '(t[io])+;aws-.*';159 t.truthy(validatePattern(multipattern, 'toti'));160 t.truthy(validatePattern(multipattern, 'aws-lambda'));161 t.truthy(validatePattern(multipattern, 'titi'));162 t.falsy(validatePattern(multipattern, 'nimp'));163 t.falsy(validatePattern(multipattern, 'naws-nlambda'));164 t.falsy(validatePattern(multipattern, 'oto'));165});166test('checkAuthorization no restriction', t => {167 t.notThrows(() =>168 checkAuthorization(169 {170 jobDefinition: 'job',171 jobQueue: 'queue'172 },173 {}174 )175 );176});177test('checkAuthorization respected restriction', t => {178 t.notThrows(() =>...

Full Screen

Full Screen

filtered-input.js

Source:filtered-input.js Github

copy

Full Screen

1import React from 'react';2import PropTypes from 'prop-types';3import validator from 'validator';4class FilteredInput extends React.Component {5 constructor(props) {6 super(props);7 this.state = {8 value: props.value ? props.value : ''9 };10 this.textChangeHandler = this.textChangeHandler.bind(this);11 }12 componentDidMount() {13 // 2017-02-07: Validate initial value if any and reset to empty if initial value is invalid.14 if (this.state.value) {15 let { validatePattern, onChange } = {...this.props};16 let passed = validatePattern ? validator.matches(this.state.value, validatePattern, 'i') : true;17 if (!passed)18 this.setState({ value: '' });19 // Signal parent component about initial validation.20 if (onChange)21 onChange(passed ? this.state.value : '', passed);22 }23 }24 render() {25 let { filterPattern, validatePattern, value, onChange, formatter, unformatter, ...rest } = this.props;26 return <input value={formatter ? formatter(this.state.value) : this.state.value} onChange={this.textChangeHandler} {...rest} />;27 }28 textChangeHandler(event) {29 let { filterPattern, validatePattern, onChange, unformatter } = this.props;30 let newValue = unformatter ? unformatter(event.target.value) : event.target.value;31 if (0 === newValue.length || validator.matches(newValue, filterPattern, 'i')) {32 this.setState({33 value: newValue34 });35 if (onChange) {36 let passed = validatePattern ? validator.matches(newValue, validatePattern, 'i') : true;37 onChange(newValue, passed);38 }39 }40 }41}42FilteredInput.propTypes = {43 type: PropTypes.string.isRequired,44 value: PropTypes.string,45 filterPattern: PropTypes.string.isRequired,46 validatePattern: PropTypes.string,47 formatter: PropTypes.func,48 unformatter: PropTypes.func,49 onChange: PropTypes.func50};...

Full Screen

Full Screen

scoreIncrement.js

Source:scoreIncrement.js Github

copy

Full Screen

1const colors = require('colors')2// Increment Positive Count3const incrementPositiveCount = function (str) {4 str = validatePattern(str)5 value = str.replace(/(Positive: )(\d+)/ig, function ($0, $1, $2) {6 return $1 + (parseInt($2) + 1);7 })8 return value9}10// Increment Neutral Count11const incrementNeutralCount = function (str) {12 validatePattern(str)13 value = str.replace(/(Neutral: )(\d+)/ig, function ($0, $1, $2) {14 return $1 + (parseInt($2) + 1);15 })16 return value17}18// Increment Negative Count19const incrementNegativeCount = function (str) {20 validatePattern(str)21 value = str.replace(/(Negative: )(\d+)/ig, function ($0, $1, $2) {22 return $1 + (parseInt($2) + 1);23 })24 return value25}26const validatePattern = function (str) {27 console.log((`validating pattern: `.magenta) + str.grey)28 const regexPattern = /^Positive: [0-9]*$/29 if (regexPattern.test(str)) { // If old pattern30 console.log('old flair pattern detected... applying the new format...'.grey)31 return str + " Neutral: 0 Negative: 0"32 } else { // If new pattern33 return str34 }...

Full Screen

Full Screen

validatePattern-test.js

Source:validatePattern-test.js Github

copy

Full Screen

...10'use strict';11const validatePattern = require('../validatePattern');12describe('validate pattern function', () => {13 it('without passed args returns true', () => {14 const isValid = validatePattern();15 expect(isValid).toBeTruthy();16 });17 it('returns true for empty pattern', () => {18 const isValid = validatePattern('');19 expect(isValid).toBeTruthy();20 });21 it('returns true for valid pattern', () => {22 const isValid = validatePattern('abc+');23 expect(isValid).toBeTruthy();24 });25 it('returns false for invalid pattern', () => {26 const isValid = validatePattern('\\');27 expect(isValid).toBeFalsy();28 });...

Full Screen

Full Screen

validatePattern.test.js

Source:validatePattern.test.js Github

copy

Full Screen

...7 */8import validatePattern from '../validatePattern';9describe('validate pattern function', () => {10 it('without passed args returns true', () => {11 const isValid = validatePattern();12 expect(isValid).toBeTruthy();13 });14 it('returns true for empty pattern', () => {15 const isValid = validatePattern('');16 expect(isValid).toBeTruthy();17 });18 it('returns true for valid pattern', () => {19 const isValid = validatePattern('abc+');20 expect(isValid).toBeTruthy();21 });22 it('returns false for invalid pattern', () => {23 const isValid = validatePattern('\\');24 expect(isValid).toBeFalsy();25 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const KarmaValidator = require('karma-validator');2const karmaValidator = new KarmaValidator();3karmaValidator.validatePattern('test.js').then((result) => {4 console.log(result);5}).catch((error) => {6 console.log(error);7});8const KarmaValidator = require('karma-validator');9const karmaValidator = new KarmaValidator();10karmaValidator.validatePattern('test.js').then((result) => {11 console.log(result);12}).catch((error) => {13 console.log(error);14});15{16}17MIT © [Karma Validator](

Full Screen

Using AI Code Generation

copy

Full Screen

1var karma = require('karma');2var karmaConfig = {3};4var karmaServer = new karma.Server(karmaConfig, function(exitCode) {5 console.log('Karma has exited with ' + exitCode);6 process.exit(exitCode);7});8karmaServer.start();

Full Screen

Using AI Code Generation

copy

Full Screen

1const {Karma} = require('./karma');2const karma = new Karma();3const pattern = "1,2,3,4,5,6,7,8,9";4const result = karma.validatePattern(pattern);5console.log(result);6class Karma {7 constructor() {8 this.pattern = [];9 }10 validatePattern(pattern) {11 const patternArray = pattern.split(',');12 let isValidPattern = true;13 patternArray.forEach((element, index) => {14 if (parseInt(element) !== index + 1) {15 isValidPattern = false;16 }17 });18 return isValidPattern;19 }20}21module.exports = {Karma};22const {Karma} = require('./karma');23const karma = new Karma();24describe('Karma', () => {25 describe('validatePattern', () => {26 it('should return true if pattern is valid', () => {27 const pattern = "1,2,3,4,5,6,7,8,9";28 const result = karma.validatePattern(pattern);29 expect(result).toBe(true);30 });31 it('should return false if pattern is invalid', () => {32 const pattern = "1,2,3,4,5,7,8,9";33 const result = karma.validatePattern(pattern);34 expect(result).toBe(false);35 });36 });37});38const {Karma} = require('./karma');39const karma = new Karma();40describe('Karma', () => {41 describe('validatePattern', () => {42 it('should return true if pattern is valid', () => {43 const pattern = "1,2,3,4,5,6,7,8,9";44 const result = karma.validatePattern(pattern);45 expect(result).toBe(true);46 });47 it('should return false if pattern is invalid', () => {48 const pattern = "1,2,3,4,5,7,8,9";49 const result = karma.validatePattern(pattern);50 expect(result).toBe(false);51 });52 });53});54const {Karma} = require('./karma');55const karma = new Karma();56describe('Karma', () => {57 describe('validatePattern', () => {58 it('should return true if pattern is valid', ()

Full Screen

Using AI Code Generation

copy

Full Screen

1const KarmaValidator = require('karma-validator');2const karmaValidator = new KarmaValidator();3const pattern = '0,1,2,3,4,5,6,7,8,9';4const result = karmaValidator.validatePattern(pattern);5const KarmaCalculator = require('karma-calculator');6const karmaCalculator = new KarmaCalculator();7const number = 1234;8const result = karmaCalculator.getKarmaScore(number);9const KarmaCalculator = require('karma-calculator');10const karmaCalculator = new KarmaCalculator();11const number = 1234;12const pattern = '0,1,2,3,4,5,6,7,8,9';13const result = karmaCalculator.getKarmaScoreFromPattern(number, pattern);14const KarmaCalculator = require('karma-calculator');15const karmaCalculator = new KarmaCalculator();16const number = 1234;17const pattern = '0,1,2,3,4,5,6,7,8,9';18const result = karmaCalculator.getKarmaScoreFromPattern(number, pattern);19const KarmaCalculator = require('karma-calculator');20const karmaCalculator = new KarmaCalculator();

Full Screen

Using AI Code Generation

copy

Full Screen

1const KarmaValidator = require('karma-validator').KarmaValidator;2const karmaValidator = new KarmaValidator();3const pattern = 'Karma';4const text = 'Karma is a unit testing framework for JavaScript';5const result = karmaValidator.validatePattern(pattern, text);6const KarmaValidator = require('karma-validator').KarmaValidator;7const karmaValidator = new KarmaValidator();8const pattern = 'Karma';9const text = 'Karma is a unit testing framework for JavaScript';10const result = karmaValidator.validatePattern(pattern, text);11#### validatePattern(pattern, text, options)12* `options` - (Optional) The options to be used for validation. The options are:

Full Screen

Using AI Code Generation

copy

Full Screen

1var KarmaTest = require('./karmaTest.js');2var test = new KarmaTest();3var result = test.validatePattern('abc');4## KarmaTest.prototype.validatePattern(pattern)5## KarmaTest.prototype.addPattern(pattern)6## KarmaTest.prototype.removePattern(pattern)7## KarmaTest.prototype.test(testString)8var KarmaTest = require('./karmaTest.js');9var test = new KarmaTest();10test.addPattern('abc');11test.addPattern('def');12test.addPattern('ghi');13test.addPattern('jkl');14test.addPattern('mno');15test.addPattern('pqr');16test.addPattern('stu');17test.addPattern('vwx');18test.addPattern('yz');19test.addPattern('123');20test.addPattern('456');21test.addPattern('789');22test.addPattern('0');23test.addPattern('ab');24test.addPattern('cd');25test.addPattern('ef');26test.addPattern('gh');27test.addPattern('ij');28test.addPattern('kl');29test.addPattern('mn');30test.addPattern('op');31test.addPattern('qr');32test.addPattern('st');33test.addPattern('uv');34test.addPattern('wx');35test.addPattern('yz');36test.addPattern('1');37test.addPattern('2');38test.addPattern('3');39test.addPattern('4');40test.addPattern('5');41test.addPattern('6');42test.addPattern('7');43test.addPattern('8');44test.addPattern('9');45test.addPattern('0');46test.addPattern('a');47test.addPattern('b');48test.addPattern('c');49test.addPattern('d');50test.addPattern('e');51test.addPattern('f');52test.addPattern('g');53test.addPattern('h');54test.addPattern('i');55test.addPattern('j');56test.addPattern('k');57test.addPattern('l');58test.addPattern('m');59test.addPattern('n');60test.addPattern('o');61test.addPattern('

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Karma automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful