Skip to main content

Posts

Showing posts with the label convert string to integer

Get previous financial year in axapta

By using this method you can Get previous financial year in axapta. If you are using from date and to date in ax and these date belongs to current financial year but your requirement is to get 1 year back financial year then you can use this method. Display str PrevFinYr() { str f,t; DtFrm = frmdt; strdtfrm = date2str(dtfrm, 123, 2, 4, 2, 4, 4); yy = str2int(substr(strdtfrm, 7, 4)); Fyy = substr(int2str(yy),3,2); DtTo = toDt; strdtto = date2str(DtTo, 123, 2, 4, 2, 4, 4); yy = str2int(substr(strdtto, 7, 4)); Tyy = substr(int2str(yy),3,2); if ((str2int(fyy)-1)<10) {  f="0"+int2str(str2int(fyy)-1);  }  else  { t=int2str(str2int(fyy)-1);  }  if ((str2int(tyy)-1)<10) { t="0"+int2str(str2int(tyy)-1); } else {  t=int2str(str2int(tyy)-1); }  PrevFinYr=f +" - "+ t; return PrevFinYr; }