Uncategorized

Extract detail from barcode on bollettini prefilled (Italy)


 

bollettino

namespace PSC
{
public class Bollettini
{
public bool getCode(string strCode)
{
bool rtn = true;

if (strCode.Length != 50)
{
return false;
}

int first = Convert.ToInt16(strCode.Substring(0, 2));
Bollettino = strCode.Substring(2, first);

int second = Convert.ToInt16(strCode.Substring(first + 2, 2));
Contocorrente = strCode.Substring(first + 4, second);

int third = Convert.ToInt16(strCode.Substring(first + second + 4, 2));
string tmp = strCode.Substring(first + second + 6, third);
Importo = Convert.ToDecimal(tmp) / 100;

int fouth = Convert.ToInt16(strCode.Substring(first + second + third + 6, 1));
Codice = strCode.Substring(first + second + third + 7, fouth);

if (Codice != "896")
{
rtn = false;
}

return rtn;
}
}
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.