Buggy code:
public class SaleTransaction extends MPOSDatabase { private GlobalPropertyDataSource mFormat ; private ShopDataSource mShop ; public SaleTransaction ( Context context ) { } public SaleTransaction . POSData_EndDaySaleTransaction getEndDayTransaction ( String sessionDate ) { } public SaleTransaction . POSData_EndDaySaleTransaction getEndDayUnSendTransaction ( String sessionDate ) { } public SaleTransaction . POSData_SaleTransaction getTransaction ( String sessionDate ) { } public SaleTransaction . POSData_SaleTransaction getSaleTransaction ( String sessionDate ) { } public SaleTransaction . POSData_SaleTransaction getSaleTransaction ( int transactionId , String sessionDate ) { } private List < SaleTransaction . SaleData_SaleTransaction > buildSaleTransLst ( Cursor cursor ) { } private List < SaleTransaction . SaleTable_PaymentDetail > buildPaymentDetailLst ( int transactionId ) { } private List < SaleTransaction . SaleTable_OrderPromotion > builderOrderPromotionLst ( Cursor cursor ) { } private List < SaleTransaction . SaleTable_OrderDetail > buildOrderDetailLst ( Cursor cursor ) { List < SaleTransaction . SaleTable_OrderDetail > orderDetailLst = new ArrayList < SaleTransaction . SaleTable_OrderDetail > ( ) ; if ( cursor != null ) { if ( cursor . moveToFirst ( ) ) { do { int transId = cursor . getInt ( cursor . getColumnIndex ( COLUMN_TRANS_ID ) ) ; int ordId = cursor . getInt ( cursor . getColumnIndex ( COLUMN_ORDER_ID ) ) ; SaleTransaction . SaleTable_OrderDetail order = new SaleTransaction . SaleTable_OrderDetail ( ) ; order . setiOrderDetailID ( ordId ) ; order . setiTransactionID ( transId ) ; order . setiComputerID ( cursor . getInt ( cursor . getColumnIndex ( COLUMN_COMPUTER_ID ) ) ) ; order . setiShopID ( mShop . getShopId ( ) ) ; order . setiVatType ( cursor . getInt ( cursor . getColumnIndex ( COLUMN_VAT_TYPE ) ) ) ; order . setiProductID ( cursor . getInt ( cursor . getColumnIndex ( COLUMN_PRODUCT_ID ) ) ) ; <START_BUG> order . setiProductTypeID ( cursor . getColumnIndex ( COLUMN_PRODUCT_TYPE_ID ) ) ; <END_BUG> order . setfQty ( Utils . fixesDigitLength ( mFormat , 4 , cursor . getDouble ( cursor . getColumnIndex ( COLUMN_ORDER_QTY ) ) ) ) ; order . setfPricePerUnit ( Utils . fixesDigitLength ( mFormat , 4 , cursor . getDouble ( cursor . getColumnIndex ( COLUMN_PRODUCT_PRICE ) ) ) ) ; order . setfRetailPrice ( Utils . fixesDigitLength ( mFormat , 4 , cursor . getDouble ( cursor . getColumnIndex ( COLUMN_TOTAL_RETAIL_PRICE ) ) ) ) ; order . setfSalePrice ( Utils . fixesDigitLength ( mFormat , 4 , cursor . getDouble ( cursor . getColumnIndex ( COLUMN_TOTAL_SALE_PRICE ) ) ) ) ; order . setfTotalVatAmount ( Utils . fixesDigitLength ( mFormat , 4 , cursor . getDouble ( cursor . getColumnIndex ( COLUMN_TOTAL_VAT ) ) ) ) ; order . setfPriceDiscountAmount ( Utils . fixesDigitLength ( mFormat , 4 , cursor . getDouble ( cursor . getColumnIndex ( COLUMN_PRICE_DISCOUNT ) ) ) ) ; order . setiSaleMode ( cursor . getInt ( cursor . getColumnIndex ( COLUMN_SALE_MODE ) ) ) ; order . setiStatusID ( cursor . getInt ( cursor . getColumnIndex ( COLUMN_ORDER_STATUS ) ) ) ; order . setxListChildOrderSetLinkType7 ( buildChildOfSet ( queryOrderSet ( transId , ordId ) ) ) ; order . setxListCommentInfo ( buildOrderComment ( queryOrderComment ( transId , ordId ) ) ) ; orderDetailLst . add ( order ) ; } while ( cursor . moveToNext ( ) ) ; } } return orderDetailLst ; } private List < SaleTransaction . SaleTable_ChildOrderType7 > buildChildOfSet ( Cursor cursor ) { } private List < SaleTransaction . SaleTable_CommentInfo > buildOrderComment ( Cursor cursor ) { } private SaleTransaction . SaleTable_SessionEndDay buildSessEnddayObj ( String sessionDate ) { } private List < SaleTransaction . SaleTable_Session > buildSessionLst ( String sessionDate ) { } private SaleTransaction . SaleTable_Session buildSessionObj ( String sessionDate ) { } private Cursor getUnSendTransaction ( String sessionDate ) { } private Cursor getLastTransaction ( String sessionDate ) { } private Cursor getSpecificTransaction ( int transactionId ) { } private Cursor getTransactionBySaleDate ( String sessionDate ) { } private Cursor getLastSession ( String sessionDate ) { } private Cursor getAllSession ( String sessionDate ) { } private Cursor querySessionEndday ( String sessionDate ) { } private Cursor queryOrderDetail ( String selection , String [ ] selectionArgs ) { } private Cursor queryPaymentDetail ( int transId ) { } private Cursor queryOrderComment ( int transId , int ordId ) { } private Cursor queryOrderSet ( int transId , int ordId ) { } private Cursor queryOrderPromotion ( int transId ) { } private Cursor queryOrderDetail ( int transId ) { } private Cursor queryOrderTransaction ( String selection , String [ ] selectionArgs , String orderBy , String limit ) { } private Cursor querySession ( String selection , String [ ] selectionArgs , String orderBy , String limit ) { } public static class POSData_EndDaySaleTransaction { private List < SaleTransaction . SaleTable_Session > xAryTableSession ; private SaleTransaction . SaleTable_SessionEndDay xTableSessionEndDay ; private List < SaleTransaction . SaleData_SaleTransaction > xArySaleTransaction ; private List < SaleTransaction . SaleData_CashInOutTransaction > xAryCashInOutTransaction ; public List < SaleTransaction . SaleData_CashInOutTransaction > getxAryCashInOutTransaction ( ) { } public void setxAryCashInOutTransaction ( List < SaleTransaction . SaleData_CashInOutTransaction > xAryCashInOutTransaction ) { } public List < SaleTransaction . SaleTable_Session > getxAryTableSession ( ) { } public void setxAryTableSession ( List < SaleTransaction . SaleTable_Session > xAryTableSession ) { } public SaleTransaction . SaleTable_SessionEndDay getxTableSessionEndDay ( ) { } public void setxTableSessionEndDay ( SaleTransaction . SaleTable_SessionEndDay xTableSessionEndDay ) { } public List < SaleTransaction . SaleData_SaleTransaction > getxArySaleTransaction ( ) { } public void setxArySaleTransaction ( List < SaleTransaction . SaleData_SaleTransaction > xArySaleTransaction ) { } } public static class POSData_SaleTransaction { private SaleTransaction . SaleTable_Session xTableSession ; private List < SaleTransaction . SaleData_SaleTransaction > xArySaleTransaction ; private List < SaleTransaction . SaleData_CashInOutTransaction > xAryCashInOutTransaction ; public List < SaleTransaction . SaleData_CashInOutTransaction > getxAryCashInOutTransaction ( ) { } public void setxAryCashInOutTransaction ( List < SaleTransaction . SaleData_CashInOutTransaction > xAryCashInOutTransaction ) { } public SaleTransaction . SaleTable_Session getxTableSession ( ) { } public void setxTableSession ( SaleTransaction . SaleTable_Session xTableSession ) { }

Fix:
order . setiProductTypeID ( cursor . getInt ( cursor . getColumnIndex ( COLUMN_PRODUCT_TYPE_ID ) ) ) ;