Hi ,
i have these code in the presection of integer data item .
CLEAR(SalesTax);
CLEAR(ServiceCharge);
CLEAR(FreightCharge);
CLEAR(PackingCharge);
CLEAR(TotalAmt);
CLEAR("ST%");
CLEAR("SrvT%");
SalesHeader1.GET("Item Specification"."Document Type","Item Specification"."Document No.");
SalesHeader1.CALCFIELDS("Amount to Customer");
SalesLine1.RESET;
SalesLine1.SETRANGE(SalesLine1."Document Type",SalesHeader1."Document Type");
SalesLine1.SETRANGE(SalesLine1."Document No.",SalesHeader1."No.");
IF SalesLine1.FINDFIRST THEN
REPEAT
IF SalesLine1."Tax Group Code" <> '' THEN
"Tax%" := FORMAT(SalesLine1."Tax %");
TaxAreaLine.SETRANGE("Tax Area",SalesLine1."Tax Area Code");
IF TaxAreaLine.FINDFIRST THEN BEGIN
TaxJuridiction.GET(TaxAreaLine."Tax Jurisdiction Code");
TaxDetails.SETRANGE("Tax Jurisdiction Code",TaxAreaLine."Tax Jurisdiction Code");
IF TaxDetails.FINDFIRST THEN
IF (SalesLine1."Tax %" <> 0) AND (SalesLine1."Form Code" = '') THEN
"Tax%" := FORMAT(TaxJuridiction."Tax Type") + ' ' + "Tax%" +'%';
IF (SalesLine1."Tax %" <> 0) AND (SalesLine1."Form Code" <> '') THEN
"Tax%" := FORMAT(TaxJuridiction."Tax Type") + ' ' + "Tax%" + '%' + ' Form ' + SalesLine1."Form Code";
END;
TotalAmt += SalesLine1."Line Amount";
MESSAGE('TOTAMT:%1',TotalAmt);//JA
UNTIL SalesLine1.NEXT = 0;
StrOrdLineDtls.RESET;
StrOrdLineDtls.SETRANGE(Type,StrOrdLineDtls.Type::Sale);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document Type",SalesHeader1."Document Type");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document No.",SalesHeader1."No.");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Type",StrOrdLineDtls."Tax/Charge Type":: "Sales Tax");
IF StrOrdLineDtls.FINDFIRST THEN
REPEAT
"ST%" := StrOrdLineDtls."Calculation Value";
SalesTax += StrOrdLineDtls.Amount;
UNTIL StrOrdLineDtls.NEXT = 0;
StrOrdLineDtls.RESET;
StrOrdLineDtls.SETRANGE(Type,StrOrdLineDtls.Type::Sale);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document Type",SalesHeader1."Document Type");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document No.",SalesHeader1."No.");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Type",StrOrdLineDtls."Tax/Charge Type":: Charges);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Group",'SERVICE');
IF StrOrdLineDtls.FINDFIRST THEN
REPEAT
"SrvT%" := StrOrdLineDtls."Calculation Value";
ServiceCharge += StrOrdLineDtls.Amount;
UNTIL StrOrdLineDtls.NEXT = 0;
StrOrdLineDtls.RESET;
StrOrdLineDtls.SETRANGE(Type,StrOrdLineDtls.Type::Sale);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document Type",SalesHeader1."Document Type");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document No.",SalesHeader1."No.");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Type",StrOrdLineDtls."Tax/Charge Type":: Charges);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Group",'FREIGHT');
IF StrOrdLineDtls.FINDFIRST THEN
REPEAT
FreightCharge += StrOrdLineDtls.Amount;
UNTIL StrOrdLineDtls.NEXT = 0;
StrOrdLineDtls.RESET;
StrOrdLineDtls.SETRANGE(Type,StrOrdLineDtls.Type::Sale);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document Type",SalesHeader1."Document Type");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Document No.",SalesHeader1."No.");
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Type",StrOrdLineDtls."Tax/Charge Type":: Charges);
StrOrdLineDtls.SETRANGE(StrOrdLineDtls."Tax/Charge Group",'PACKING');
IF StrOrdLineDtls.FINDFIRST THEN
REPEAT
PackingCharge += StrOrdLineDtls.Amount;
UNTIL StrOrdLineDtls.NEXT = 0;
DiscountAmount := TotalAmt - (SalesHeader1."Amount to Customer" - SalesTax - ServiceCharge - FreightCharge - PackingCharge);
IF ServiceCharge = 0 THEN
ServiceChargeT := SalesHeader."Packing Charge"
ELSE
ServiceChargeT := FORMAT(ServiceCharge);
IF FreightCharge = 0 THEN
FreightChargeT := SalesHeader."Freight Charge"
ELSE
FreightChargeT := FORMAT(FreightCharge);
IF PackingCharge = 0 THEN
PackingChargeT := SalesHeader."Packing Charge"
ELSE
PackingChargeT := FORMAT(PackingCharge);
i just copied these codes and paste it in the onaftergetrecord of integer data item ,but my values is not coming.