Isaque, esta nova função CstICMSToStr abaixo quando passa o parâmetro por exemplo: sticmsSimplesNacionalCobradoAnteriormentePorST, em vez de retornar 500 está retornando 1900. Mas eu desconheço esses novos CTS´s com 4 dígitos não sei qual é a finalidade.
CstIcms: array[0..167] of String = (
'000','010','020','030','040','041','050','051','060','070','090','0101','0102','0103','0201','0202','0203','0300','0400','0500','0900',
'100','110','120','130','140','141','150','151','160','170','190','1101','1102','1103','1201','1202','1203','1300','1400','1500','1900',
'200','210','220','230','240','241','250','251','260','270','290','2101','2102','2103','2201','2202','2203','2300','2400','2500','2900',
'300','310','320','330','340','341','350','351','360','370','390','3101','3102','3103','3201','3202','3203','3300','3400','3500','3900',
'400','410','420','430','440','441','450','451','460','470','490','4101','4102','4103','4201','4202','4203','4300','4400','4500','4900',
'500','510','520','530','540','541','550','551','560','570','590','5101','5102','5103','5201','5202','5203','5300','5400','5500','5900',
'600','610','620','630','640','641','650','651','660','670','690','6101','6102','6103','6201','6202','6203','6300','6400','6500','6900',
'700','710','720','730','740','741','750','751','760','770','790','7101','7102','7103','7201','7202','7203','7300','7400','7500','7900');
function CstIcmsToStr(AValue: TACBrCstIcms): string;
begin
Result := CstIcms[ Integer( AValue ) ];
end;