Subversion Repositories SmartDukaan

Rev

Rev 23081 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

from thrift.Thrift import *
import shop2020.thriftpy.generic.ttypes


from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class POStatus:
  INIT = 0
  READY = 1
  PARTIALLY_FULFILLED = 2
  PRECLOSED = 3
  CLOSED = 4

  _VALUES_TO_NAMES = {
    0: "INIT",
    1: "READY",
    2: "PARTIALLY_FULFILLED",
    3: "PRECLOSED",
    4: "CLOSED",
  }

  _NAMES_TO_VALUES = {
    "INIT": 0,
    "READY": 1,
    "PARTIALLY_FULFILLED": 2,
    "PRECLOSED": 3,
    "CLOSED": 4,
  }

class POType:
  REAL = 1
  VIRTUAL = 2

  _VALUES_TO_NAMES = {
    1: "REAL",
    2: "VIRTUAL",
  }

  _NAMES_TO_VALUES = {
    "REAL": 1,
    "VIRTUAL": 2,
  }

class PurchaseReturnType:
  REAL = 1
  VIRTUAL = 2

  _VALUES_TO_NAMES = {
    1: "REAL",
    2: "VIRTUAL",
  }

  _NAMES_TO_VALUES = {
    "REAL": 1,
    "VIRTUAL": 2,
  }

class PurchaseReturnInventoryType:
  GOOD = 1
  BAD = 2

  _VALUES_TO_NAMES = {
    1: "GOOD",
    2: "BAD",
  }

  _NAMES_TO_VALUES = {
    "GOOD": 1,
    "BAD": 2,
  }

class TaxType:
  VAT = 0
  CST = 1
  CFORM = 2
  IGST = 3
  SGST = 4

  _VALUES_TO_NAMES = {
    0: "VAT",
    1: "CST",
    2: "CFORM",
    3: "IGST",
    4: "SGST",
  }

  _NAMES_TO_VALUES = {
    "VAT": 0,
    "CST": 1,
    "CFORM": 2,
    "IGST": 3,
    "SGST": 4,
  }

class PrReasonType:
  WRONG_GRN = 1
  ACTUAL_PR = 2
  REPLACEMENT = 3

  _VALUES_TO_NAMES = {
    1: "WRONG_GRN",
    2: "ACTUAL_PR",
    3: "REPLACEMENT",
  }

  _NAMES_TO_VALUES = {
    "WRONG_GRN": 1,
    "ACTUAL_PR": 2,
    "REPLACEMENT": 3,
  }

class SettlementType:
  CREDIT_NOTE = 1
  REPLACEMENT = 2
  AGAINST_GRN = 3

  _VALUES_TO_NAMES = {
    1: "CREDIT_NOTE",
    2: "REPLACEMENT",
    3: "AGAINST_GRN",
  }

  _NAMES_TO_VALUES = {
    "CREDIT_NOTE": 1,
    "REPLACEMENT": 2,
    "AGAINST_GRN": 3,
  }


class Supplier:
  """
  Attributes:
   - id
   - name
   - phone
   - fax
   - tin
   - pan
   - headName
   - headDesignation
   - headEmail
   - contactName
   - contactPhone
   - contactFax
   - contactEmail
   - registeredAddress
   - communicationAddress
   - stateId
   - poValidityLimit
   - gstin
   - tnc
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.STRING, 'name', None, None, ), # 2
    (3, TType.STRING, 'phone', None, None, ), # 3
    (4, TType.STRING, 'fax', None, None, ), # 4
    (5, TType.STRING, 'tin', None, None, ), # 5
    (6, TType.STRING, 'pan', None, None, ), # 6
    (7, TType.STRING, 'headName', None, None, ), # 7
    (8, TType.STRING, 'headDesignation', None, None, ), # 8
    (9, TType.STRING, 'headEmail', None, None, ), # 9
    (10, TType.STRING, 'contactName', None, None, ), # 10
    (11, TType.STRING, 'contactPhone', None, None, ), # 11
    (12, TType.STRING, 'contactFax', None, None, ), # 12
    (13, TType.STRING, 'contactEmail', None, None, ), # 13
    (14, TType.STRING, 'registeredAddress', None, None, ), # 14
    (15, TType.STRING, 'communicationAddress', None, None, ), # 15
    (16, TType.I64, 'stateId', None, None, ), # 16
    (17, TType.I64, 'poValidityLimit', None, None, ), # 17
    (18, TType.STRING, 'gstin', None, None, ), # 18
    (19, TType.STRING, 'tnc', None, None, ), # 19
  )

  def __init__(self, id=None, name=None, phone=None, fax=None, tin=None, pan=None, headName=None, headDesignation=None, headEmail=None, contactName=None, contactPhone=None, contactFax=None, contactEmail=None, registeredAddress=None, communicationAddress=None, stateId=None, poValidityLimit=None, gstin=None, tnc=None,):
    self.id = id
    self.name = name
    self.phone = phone
    self.fax = fax
    self.tin = tin
    self.pan = pan
    self.headName = headName
    self.headDesignation = headDesignation
    self.headEmail = headEmail
    self.contactName = contactName
    self.contactPhone = contactPhone
    self.contactFax = contactFax
    self.contactEmail = contactEmail
    self.registeredAddress = registeredAddress
    self.communicationAddress = communicationAddress
    self.stateId = stateId
    self.poValidityLimit = poValidityLimit
    self.gstin = gstin
    self.tnc = tnc

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.name = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.phone = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.fax = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.tin = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.pan = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRING:
          self.headName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.STRING:
          self.headDesignation = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.STRING:
          self.headEmail = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.STRING:
          self.contactName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.STRING:
          self.contactPhone = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.STRING:
          self.contactFax = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 13:
        if ftype == TType.STRING:
          self.contactEmail = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 14:
        if ftype == TType.STRING:
          self.registeredAddress = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 15:
        if ftype == TType.STRING:
          self.communicationAddress = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 16:
        if ftype == TType.I64:
          self.stateId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 17:
        if ftype == TType.I64:
          self.poValidityLimit = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 18:
        if ftype == TType.STRING:
          self.gstin = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 19:
        if ftype == TType.STRING:
          self.tnc = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Supplier')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.name is not None:
      oprot.writeFieldBegin('name', TType.STRING, 2)
      oprot.writeString(self.name)
      oprot.writeFieldEnd()
    if self.phone is not None:
      oprot.writeFieldBegin('phone', TType.STRING, 3)
      oprot.writeString(self.phone)
      oprot.writeFieldEnd()
    if self.fax is not None:
      oprot.writeFieldBegin('fax', TType.STRING, 4)
      oprot.writeString(self.fax)
      oprot.writeFieldEnd()
    if self.tin is not None:
      oprot.writeFieldBegin('tin', TType.STRING, 5)
      oprot.writeString(self.tin)
      oprot.writeFieldEnd()
    if self.pan is not None:
      oprot.writeFieldBegin('pan', TType.STRING, 6)
      oprot.writeString(self.pan)
      oprot.writeFieldEnd()
    if self.headName is not None:
      oprot.writeFieldBegin('headName', TType.STRING, 7)
      oprot.writeString(self.headName)
      oprot.writeFieldEnd()
    if self.headDesignation is not None:
      oprot.writeFieldBegin('headDesignation', TType.STRING, 8)
      oprot.writeString(self.headDesignation)
      oprot.writeFieldEnd()
    if self.headEmail is not None:
      oprot.writeFieldBegin('headEmail', TType.STRING, 9)
      oprot.writeString(self.headEmail)
      oprot.writeFieldEnd()
    if self.contactName is not None:
      oprot.writeFieldBegin('contactName', TType.STRING, 10)
      oprot.writeString(self.contactName)
      oprot.writeFieldEnd()
    if self.contactPhone is not None:
      oprot.writeFieldBegin('contactPhone', TType.STRING, 11)
      oprot.writeString(self.contactPhone)
      oprot.writeFieldEnd()
    if self.contactFax is not None:
      oprot.writeFieldBegin('contactFax', TType.STRING, 12)
      oprot.writeString(self.contactFax)
      oprot.writeFieldEnd()
    if self.contactEmail is not None:
      oprot.writeFieldBegin('contactEmail', TType.STRING, 13)
      oprot.writeString(self.contactEmail)
      oprot.writeFieldEnd()
    if self.registeredAddress is not None:
      oprot.writeFieldBegin('registeredAddress', TType.STRING, 14)
      oprot.writeString(self.registeredAddress)
      oprot.writeFieldEnd()
    if self.communicationAddress is not None:
      oprot.writeFieldBegin('communicationAddress', TType.STRING, 15)
      oprot.writeString(self.communicationAddress)
      oprot.writeFieldEnd()
    if self.stateId is not None:
      oprot.writeFieldBegin('stateId', TType.I64, 16)
      oprot.writeI64(self.stateId)
      oprot.writeFieldEnd()
    if self.poValidityLimit is not None:
      oprot.writeFieldBegin('poValidityLimit', TType.I64, 17)
      oprot.writeI64(self.poValidityLimit)
      oprot.writeFieldEnd()
    if self.gstin is not None:
      oprot.writeFieldBegin('gstin', TType.STRING, 18)
      oprot.writeString(self.gstin)
      oprot.writeFieldEnd()
    if self.tnc is not None:
      oprot.writeFieldBegin('tnc', TType.STRING, 19)
      oprot.writeString(self.tnc)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class LineItem:
  """
  Attributes:
   - orderId
   - itemId
   - productGroup
   - brand
   - modelNumber
   - modelName
   - color
   - itemNumber
   - quantity
   - unfulfilledQuantity
   - createdAt
   - unitPrice
   - fulfilled
   - codCount
   - availableQuantity
   - reservedQuantity
   - avgSales
   - minStockLevel
   - numberOfDaysStock
   - suggestedQuantity
   - numberOfDaysInStock
   - rtoOrders
   - lastXdaysSale
   - previouslyOrderedQty
   - nlc
   - mrp
   - nlcP
   - vatDiff
   - igstRate
   - cgstRate
   - sgstRate
   - hsnCode
   - invoicePrice
   - tp
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'orderId', None, None, ), # 1
    (2, TType.I64, 'itemId', None, None, ), # 2
    (3, TType.STRING, 'productGroup', None, None, ), # 3
    (4, TType.STRING, 'brand', None, None, ), # 4
    (5, TType.STRING, 'modelNumber', None, None, ), # 5
    (6, TType.STRING, 'modelName', None, None, ), # 6
    (7, TType.STRING, 'color', None, None, ), # 7
    (8, TType.STRING, 'itemNumber', None, None, ), # 8
    (9, TType.DOUBLE, 'quantity', None, None, ), # 9
    (10, TType.DOUBLE, 'unfulfilledQuantity', None, None, ), # 10
    (11, TType.I64, 'createdAt', None, None, ), # 11
    (12, TType.DOUBLE, 'unitPrice', None, None, ), # 12
    (13, TType.BOOL, 'fulfilled', None, None, ), # 13
    (14, TType.I64, 'codCount', None, None, ), # 14
    (15, TType.I64, 'availableQuantity', None, None, ), # 15
    (16, TType.I64, 'reservedQuantity', None, None, ), # 16
    (17, TType.DOUBLE, 'avgSales', None, None, ), # 17
    (18, TType.I64, 'minStockLevel', None, None, ), # 18
    (19, TType.I64, 'numberOfDaysStock', None, None, ), # 19
    (20, TType.I64, 'suggestedQuantity', None, None, ), # 20
    (21, TType.I64, 'numberOfDaysInStock', None, None, ), # 21
    (22, TType.I64, 'rtoOrders', None, None, ), # 22
    (23, TType.STRING, 'lastXdaysSale', None, None, ), # 23
    (24, TType.I64, 'previouslyOrderedQty', None, None, ), # 24
    (25, TType.DOUBLE, 'nlc', None, None, ), # 25
    (26, TType.DOUBLE, 'mrp', None, None, ), # 26
    (27, TType.DOUBLE, 'nlcP', None, None, ), # 27
    (28, TType.DOUBLE, 'vatDiff', None, None, ), # 28
    (29, TType.DOUBLE, 'igstRate', None, None, ), # 29
    (30, TType.DOUBLE, 'cgstRate', None, None, ), # 30
    (31, TType.DOUBLE, 'sgstRate', None, None, ), # 31
    (32, TType.STRING, 'hsnCode', None, None, ), # 32
    (33, TType.DOUBLE, 'invoicePrice', None, None, ), # 33
    (34, TType.DOUBLE, 'tp', None, None, ), # 34
  )

  def __init__(self, orderId=None, itemId=None, productGroup=None, brand=None, modelNumber=None, modelName=None, color=None, itemNumber=None, quantity=None, unfulfilledQuantity=None, createdAt=None, unitPrice=None, fulfilled=None, codCount=None, availableQuantity=None, reservedQuantity=None, avgSales=None, minStockLevel=None, numberOfDaysStock=None, suggestedQuantity=None, numberOfDaysInStock=None, rtoOrders=None, lastXdaysSale=None, previouslyOrderedQty=None, nlc=None, mrp=None, nlcP=None, vatDiff=None, igstRate=None, cgstRate=None, sgstRate=None, hsnCode=None, invoicePrice=None, tp=None,):
    self.orderId = orderId
    self.itemId = itemId
    self.productGroup = productGroup
    self.brand = brand
    self.modelNumber = modelNumber
    self.modelName = modelName
    self.color = color
    self.itemNumber = itemNumber
    self.quantity = quantity
    self.unfulfilledQuantity = unfulfilledQuantity
    self.createdAt = createdAt
    self.unitPrice = unitPrice
    self.fulfilled = fulfilled
    self.codCount = codCount
    self.availableQuantity = availableQuantity
    self.reservedQuantity = reservedQuantity
    self.avgSales = avgSales
    self.minStockLevel = minStockLevel
    self.numberOfDaysStock = numberOfDaysStock
    self.suggestedQuantity = suggestedQuantity
    self.numberOfDaysInStock = numberOfDaysInStock
    self.rtoOrders = rtoOrders
    self.lastXdaysSale = lastXdaysSale
    self.previouslyOrderedQty = previouslyOrderedQty
    self.nlc = nlc
    self.mrp = mrp
    self.nlcP = nlcP
    self.vatDiff = vatDiff
    self.igstRate = igstRate
    self.cgstRate = cgstRate
    self.sgstRate = sgstRate
    self.hsnCode = hsnCode
    self.invoicePrice = invoicePrice
    self.tp = tp

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.orderId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.itemId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.productGroup = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.brand = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.modelNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.modelName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRING:
          self.color = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.STRING:
          self.itemNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.DOUBLE:
          self.quantity = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.DOUBLE:
          self.unfulfilledQuantity = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.I64:
          self.createdAt = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.DOUBLE:
          self.unitPrice = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 13:
        if ftype == TType.BOOL:
          self.fulfilled = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 14:
        if ftype == TType.I64:
          self.codCount = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 15:
        if ftype == TType.I64:
          self.availableQuantity = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 16:
        if ftype == TType.I64:
          self.reservedQuantity = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 17:
        if ftype == TType.DOUBLE:
          self.avgSales = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 18:
        if ftype == TType.I64:
          self.minStockLevel = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 19:
        if ftype == TType.I64:
          self.numberOfDaysStock = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 20:
        if ftype == TType.I64:
          self.suggestedQuantity = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 21:
        if ftype == TType.I64:
          self.numberOfDaysInStock = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 22:
        if ftype == TType.I64:
          self.rtoOrders = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 23:
        if ftype == TType.STRING:
          self.lastXdaysSale = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 24:
        if ftype == TType.I64:
          self.previouslyOrderedQty = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 25:
        if ftype == TType.DOUBLE:
          self.nlc = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 26:
        if ftype == TType.DOUBLE:
          self.mrp = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 27:
        if ftype == TType.DOUBLE:
          self.nlcP = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 28:
        if ftype == TType.DOUBLE:
          self.vatDiff = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 29:
        if ftype == TType.DOUBLE:
          self.igstRate = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 30:
        if ftype == TType.DOUBLE:
          self.cgstRate = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 31:
        if ftype == TType.DOUBLE:
          self.sgstRate = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 32:
        if ftype == TType.STRING:
          self.hsnCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 33:
        if ftype == TType.DOUBLE:
          self.invoicePrice = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 34:
        if ftype == TType.DOUBLE:
          self.tp = iprot.readDouble();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('LineItem')
    if self.orderId is not None:
      oprot.writeFieldBegin('orderId', TType.I64, 1)
      oprot.writeI64(self.orderId)
      oprot.writeFieldEnd()
    if self.itemId is not None:
      oprot.writeFieldBegin('itemId', TType.I64, 2)
      oprot.writeI64(self.itemId)
      oprot.writeFieldEnd()
    if self.productGroup is not None:
      oprot.writeFieldBegin('productGroup', TType.STRING, 3)
      oprot.writeString(self.productGroup)
      oprot.writeFieldEnd()
    if self.brand is not None:
      oprot.writeFieldBegin('brand', TType.STRING, 4)
      oprot.writeString(self.brand)
      oprot.writeFieldEnd()
    if self.modelNumber is not None:
      oprot.writeFieldBegin('modelNumber', TType.STRING, 5)
      oprot.writeString(self.modelNumber)
      oprot.writeFieldEnd()
    if self.modelName is not None:
      oprot.writeFieldBegin('modelName', TType.STRING, 6)
      oprot.writeString(self.modelName)
      oprot.writeFieldEnd()
    if self.color is not None:
      oprot.writeFieldBegin('color', TType.STRING, 7)
      oprot.writeString(self.color)
      oprot.writeFieldEnd()
    if self.itemNumber is not None:
      oprot.writeFieldBegin('itemNumber', TType.STRING, 8)
      oprot.writeString(self.itemNumber)
      oprot.writeFieldEnd()
    if self.quantity is not None:
      oprot.writeFieldBegin('quantity', TType.DOUBLE, 9)
      oprot.writeDouble(self.quantity)
      oprot.writeFieldEnd()
    if self.unfulfilledQuantity is not None:
      oprot.writeFieldBegin('unfulfilledQuantity', TType.DOUBLE, 10)
      oprot.writeDouble(self.unfulfilledQuantity)
      oprot.writeFieldEnd()
    if self.createdAt is not None:
      oprot.writeFieldBegin('createdAt', TType.I64, 11)
      oprot.writeI64(self.createdAt)
      oprot.writeFieldEnd()
    if self.unitPrice is not None:
      oprot.writeFieldBegin('unitPrice', TType.DOUBLE, 12)
      oprot.writeDouble(self.unitPrice)
      oprot.writeFieldEnd()
    if self.fulfilled is not None:
      oprot.writeFieldBegin('fulfilled', TType.BOOL, 13)
      oprot.writeBool(self.fulfilled)
      oprot.writeFieldEnd()
    if self.codCount is not None:
      oprot.writeFieldBegin('codCount', TType.I64, 14)
      oprot.writeI64(self.codCount)
      oprot.writeFieldEnd()
    if self.availableQuantity is not None:
      oprot.writeFieldBegin('availableQuantity', TType.I64, 15)
      oprot.writeI64(self.availableQuantity)
      oprot.writeFieldEnd()
    if self.reservedQuantity is not None:
      oprot.writeFieldBegin('reservedQuantity', TType.I64, 16)
      oprot.writeI64(self.reservedQuantity)
      oprot.writeFieldEnd()
    if self.avgSales is not None:
      oprot.writeFieldBegin('avgSales', TType.DOUBLE, 17)
      oprot.writeDouble(self.avgSales)
      oprot.writeFieldEnd()
    if self.minStockLevel is not None:
      oprot.writeFieldBegin('minStockLevel', TType.I64, 18)
      oprot.writeI64(self.minStockLevel)
      oprot.writeFieldEnd()
    if self.numberOfDaysStock is not None:
      oprot.writeFieldBegin('numberOfDaysStock', TType.I64, 19)
      oprot.writeI64(self.numberOfDaysStock)
      oprot.writeFieldEnd()
    if self.suggestedQuantity is not None:
      oprot.writeFieldBegin('suggestedQuantity', TType.I64, 20)
      oprot.writeI64(self.suggestedQuantity)
      oprot.writeFieldEnd()
    if self.numberOfDaysInStock is not None:
      oprot.writeFieldBegin('numberOfDaysInStock', TType.I64, 21)
      oprot.writeI64(self.numberOfDaysInStock)
      oprot.writeFieldEnd()
    if self.rtoOrders is not None:
      oprot.writeFieldBegin('rtoOrders', TType.I64, 22)
      oprot.writeI64(self.rtoOrders)
      oprot.writeFieldEnd()
    if self.lastXdaysSale is not None:
      oprot.writeFieldBegin('lastXdaysSale', TType.STRING, 23)
      oprot.writeString(self.lastXdaysSale)
      oprot.writeFieldEnd()
    if self.previouslyOrderedQty is not None:
      oprot.writeFieldBegin('previouslyOrderedQty', TType.I64, 24)
      oprot.writeI64(self.previouslyOrderedQty)
      oprot.writeFieldEnd()
    if self.nlc is not None:
      oprot.writeFieldBegin('nlc', TType.DOUBLE, 25)
      oprot.writeDouble(self.nlc)
      oprot.writeFieldEnd()
    if self.mrp is not None:
      oprot.writeFieldBegin('mrp', TType.DOUBLE, 26)
      oprot.writeDouble(self.mrp)
      oprot.writeFieldEnd()
    if self.nlcP is not None:
      oprot.writeFieldBegin('nlcP', TType.DOUBLE, 27)
      oprot.writeDouble(self.nlcP)
      oprot.writeFieldEnd()
    if self.vatDiff is not None:
      oprot.writeFieldBegin('vatDiff', TType.DOUBLE, 28)
      oprot.writeDouble(self.vatDiff)
      oprot.writeFieldEnd()
    if self.igstRate is not None:
      oprot.writeFieldBegin('igstRate', TType.DOUBLE, 29)
      oprot.writeDouble(self.igstRate)
      oprot.writeFieldEnd()
    if self.cgstRate is not None:
      oprot.writeFieldBegin('cgstRate', TType.DOUBLE, 30)
      oprot.writeDouble(self.cgstRate)
      oprot.writeFieldEnd()
    if self.sgstRate is not None:
      oprot.writeFieldBegin('sgstRate', TType.DOUBLE, 31)
      oprot.writeDouble(self.sgstRate)
      oprot.writeFieldEnd()
    if self.hsnCode is not None:
      oprot.writeFieldBegin('hsnCode', TType.STRING, 32)
      oprot.writeString(self.hsnCode)
      oprot.writeFieldEnd()
    if self.invoicePrice is not None:
      oprot.writeFieldBegin('invoicePrice', TType.DOUBLE, 33)
      oprot.writeDouble(self.invoicePrice)
      oprot.writeFieldEnd()
    if self.tp is not None:
      oprot.writeFieldBegin('tp', TType.DOUBLE, 34)
      oprot.writeDouble(self.tp)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PurchaseOrder:
  """
  Attributes:
   - id
   - poNumber
   - lineitems
   - supplierId
   - warehouseId
   - shippingWarehouseId
   - status
   - createdAt
   - updatedAt
   - totalCost
   - freightCharges
   - realizedCost
   - realizedFreightCharges
   - type
   - taxType
   - warehouseAddressId
   - shippingWarehouseAddressId
   - buyerId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.STRING, 'poNumber', None, None, ), # 2
    (3, TType.LIST, 'lineitems', (TType.STRUCT,(LineItem, LineItem.thrift_spec)), None, ), # 3
    (4, TType.I64, 'supplierId', None, None, ), # 4
    (5, TType.I64, 'warehouseId', None, None, ), # 5
    (6, TType.I64, 'shippingWarehouseId', None, None, ), # 6
    (7, TType.I32, 'status', None, None, ), # 7
    (8, TType.I64, 'createdAt', None, None, ), # 8
    (9, TType.I64, 'updatedAt', None, None, ), # 9
    (10, TType.DOUBLE, 'totalCost', None, None, ), # 10
    (11, TType.DOUBLE, 'freightCharges', None, None, ), # 11
    (12, TType.DOUBLE, 'realizedCost', None, None, ), # 12
    (13, TType.DOUBLE, 'realizedFreightCharges', None, None, ), # 13
    (14, TType.I32, 'type', None, None, ), # 14
    (15, TType.I32, 'taxType', None, None, ), # 15
    (16, TType.I64, 'warehouseAddressId', None, None, ), # 16
    (17, TType.I64, 'shippingWarehouseAddressId', None, None, ), # 17
    (18, TType.I64, 'buyerId', None, None, ), # 18
  )

  def __init__(self, id=None, poNumber=None, lineitems=None, supplierId=None, warehouseId=None, shippingWarehouseId=None, status=None, createdAt=None, updatedAt=None, totalCost=None, freightCharges=None, realizedCost=None, realizedFreightCharges=None, type=None, taxType=None, warehouseAddressId=None, shippingWarehouseAddressId=None, buyerId=None,):
    self.id = id
    self.poNumber = poNumber
    self.lineitems = lineitems
    self.supplierId = supplierId
    self.warehouseId = warehouseId
    self.shippingWarehouseId = shippingWarehouseId
    self.status = status
    self.createdAt = createdAt
    self.updatedAt = updatedAt
    self.totalCost = totalCost
    self.freightCharges = freightCharges
    self.realizedCost = realizedCost
    self.realizedFreightCharges = realizedFreightCharges
    self.type = type
    self.taxType = taxType
    self.warehouseAddressId = warehouseAddressId
    self.shippingWarehouseAddressId = shippingWarehouseAddressId
    self.buyerId = buyerId

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.poNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.LIST:
          self.lineitems = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = LineItem()
            _elem5.read(iprot)
            self.lineitems.append(_elem5)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.supplierId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.I64:
          self.warehouseId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I64:
          self.shippingWarehouseId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.I64:
          self.createdAt = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.I64:
          self.updatedAt = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.DOUBLE:
          self.totalCost = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.DOUBLE:
          self.freightCharges = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.DOUBLE:
          self.realizedCost = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 13:
        if ftype == TType.DOUBLE:
          self.realizedFreightCharges = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 14:
        if ftype == TType.I32:
          self.type = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 15:
        if ftype == TType.I32:
          self.taxType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 16:
        if ftype == TType.I64:
          self.warehouseAddressId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 17:
        if ftype == TType.I64:
          self.shippingWarehouseAddressId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 18:
        if ftype == TType.I64:
          self.buyerId = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PurchaseOrder')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.poNumber is not None:
      oprot.writeFieldBegin('poNumber', TType.STRING, 2)
      oprot.writeString(self.poNumber)
      oprot.writeFieldEnd()
    if self.lineitems is not None:
      oprot.writeFieldBegin('lineitems', TType.LIST, 3)
      oprot.writeListBegin(TType.STRUCT, len(self.lineitems))
      for iter6 in self.lineitems:
        iter6.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.supplierId is not None:
      oprot.writeFieldBegin('supplierId', TType.I64, 4)
      oprot.writeI64(self.supplierId)
      oprot.writeFieldEnd()
    if self.warehouseId is not None:
      oprot.writeFieldBegin('warehouseId', TType.I64, 5)
      oprot.writeI64(self.warehouseId)
      oprot.writeFieldEnd()
    if self.shippingWarehouseId is not None:
      oprot.writeFieldBegin('shippingWarehouseId', TType.I64, 6)
      oprot.writeI64(self.shippingWarehouseId)
      oprot.writeFieldEnd()
    if self.status is not None:
      oprot.writeFieldBegin('status', TType.I32, 7)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.createdAt is not None:
      oprot.writeFieldBegin('createdAt', TType.I64, 8)
      oprot.writeI64(self.createdAt)
      oprot.writeFieldEnd()
    if self.updatedAt is not None:
      oprot.writeFieldBegin('updatedAt', TType.I64, 9)
      oprot.writeI64(self.updatedAt)
      oprot.writeFieldEnd()
    if self.totalCost is not None:
      oprot.writeFieldBegin('totalCost', TType.DOUBLE, 10)
      oprot.writeDouble(self.totalCost)
      oprot.writeFieldEnd()
    if self.freightCharges is not None:
      oprot.writeFieldBegin('freightCharges', TType.DOUBLE, 11)
      oprot.writeDouble(self.freightCharges)
      oprot.writeFieldEnd()
    if self.realizedCost is not None:
      oprot.writeFieldBegin('realizedCost', TType.DOUBLE, 12)
      oprot.writeDouble(self.realizedCost)
      oprot.writeFieldEnd()
    if self.realizedFreightCharges is not None:
      oprot.writeFieldBegin('realizedFreightCharges', TType.DOUBLE, 13)
      oprot.writeDouble(self.realizedFreightCharges)
      oprot.writeFieldEnd()
    if self.type is not None:
      oprot.writeFieldBegin('type', TType.I32, 14)
      oprot.writeI32(self.type)
      oprot.writeFieldEnd()
    if self.taxType is not None:
      oprot.writeFieldBegin('taxType', TType.I32, 15)
      oprot.writeI32(self.taxType)
      oprot.writeFieldEnd()
    if self.warehouseAddressId is not None:
      oprot.writeFieldBegin('warehouseAddressId', TType.I64, 16)
      oprot.writeI64(self.warehouseAddressId)
      oprot.writeFieldEnd()
    if self.shippingWarehouseAddressId is not None:
      oprot.writeFieldBegin('shippingWarehouseAddressId', TType.I64, 17)
      oprot.writeI64(self.shippingWarehouseAddressId)
      oprot.writeFieldEnd()
    if self.buyerId is not None:
      oprot.writeFieldBegin('buyerId', TType.I64, 18)
      oprot.writeI64(self.buyerId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Purchase:
  """
  Attributes:
   - id
   - poId
   - invoiceNumber
   - receivedOn
   - freightCharges
   - purchaseComments
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.I64, 'poId', None, None, ), # 2
    (3, TType.STRING, 'invoiceNumber', None, None, ), # 3
    (4, TType.I64, 'receivedOn', None, None, ), # 4
    (5, TType.DOUBLE, 'freightCharges', None, None, ), # 5
    (6, TType.STRING, 'purchaseComments', None, None, ), # 6
  )

  def __init__(self, id=None, poId=None, invoiceNumber=None, receivedOn=None, freightCharges=None, purchaseComments=None,):
    self.id = id
    self.poId = poId
    self.invoiceNumber = invoiceNumber
    self.receivedOn = receivedOn
    self.freightCharges = freightCharges
    self.purchaseComments = purchaseComments

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.poId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.invoiceNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.receivedOn = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.DOUBLE:
          self.freightCharges = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.purchaseComments = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Purchase')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.poId is not None:
      oprot.writeFieldBegin('poId', TType.I64, 2)
      oprot.writeI64(self.poId)
      oprot.writeFieldEnd()
    if self.invoiceNumber is not None:
      oprot.writeFieldBegin('invoiceNumber', TType.STRING, 3)
      oprot.writeString(self.invoiceNumber)
      oprot.writeFieldEnd()
    if self.receivedOn is not None:
      oprot.writeFieldBegin('receivedOn', TType.I64, 4)
      oprot.writeI64(self.receivedOn)
      oprot.writeFieldEnd()
    if self.freightCharges is not None:
      oprot.writeFieldBegin('freightCharges', TType.DOUBLE, 5)
      oprot.writeDouble(self.freightCharges)
      oprot.writeFieldEnd()
    if self.purchaseComments is not None:
      oprot.writeFieldBegin('purchaseComments', TType.STRING, 6)
      oprot.writeString(self.purchaseComments)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PurchaseReturn:
  """
  Attributes:
   - id
   - vendorId
   - amount
   - returnTimestamp
   - isSettled
   - type
   - returnInventoryType
   - currentSettlementType
   - latestSettlementDate
   - purchaseReturnType
   - reasonText
   - documentNumber
   - createdBy
   - unsettledAmount
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.I64, 'vendorId', None, None, ), # 2
    (3, TType.I64, 'amount', None, None, ), # 3
    (4, TType.I64, 'returnTimestamp', None, None, ), # 4
    (5, TType.BOOL, 'isSettled', None, None, ), # 5
    (6, TType.I32, 'type', None, None, ), # 6
    (7, TType.I32, 'returnInventoryType', None, None, ), # 7
    (8, TType.I32, 'currentSettlementType', None, None, ), # 8
    (9, TType.I64, 'latestSettlementDate', None, None, ), # 9
    (10, TType.I32, 'purchaseReturnType', None, None, ), # 10
    (11, TType.STRING, 'reasonText', None, None, ), # 11
    (12, TType.STRING, 'documentNumber', None, None, ), # 12
    (13, TType.STRING, 'createdBy', None, None, ), # 13
    (14, TType.I64, 'unsettledAmount', None, None, ), # 14
  )

  def __init__(self, id=None, vendorId=None, amount=None, returnTimestamp=None, isSettled=None, type=None, returnInventoryType=None, currentSettlementType=None, latestSettlementDate=None, purchaseReturnType=None, reasonText=None, documentNumber=None, createdBy=None, unsettledAmount=None,):
    self.id = id
    self.vendorId = vendorId
    self.amount = amount
    self.returnTimestamp = returnTimestamp
    self.isSettled = isSettled
    self.type = type
    self.returnInventoryType = returnInventoryType
    self.currentSettlementType = currentSettlementType
    self.latestSettlementDate = latestSettlementDate
    self.purchaseReturnType = purchaseReturnType
    self.reasonText = reasonText
    self.documentNumber = documentNumber
    self.createdBy = createdBy
    self.unsettledAmount = unsettledAmount

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.vendorId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.amount = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.returnTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.BOOL:
          self.isSettled = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I32:
          self.type = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.I32:
          self.returnInventoryType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.I32:
          self.currentSettlementType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.I64:
          self.latestSettlementDate = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.I32:
          self.purchaseReturnType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.STRING:
          self.reasonText = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.STRING:
          self.documentNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 13:
        if ftype == TType.STRING:
          self.createdBy = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 14:
        if ftype == TType.I64:
          self.unsettledAmount = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PurchaseReturn')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.vendorId is not None:
      oprot.writeFieldBegin('vendorId', TType.I64, 2)
      oprot.writeI64(self.vendorId)
      oprot.writeFieldEnd()
    if self.amount is not None:
      oprot.writeFieldBegin('amount', TType.I64, 3)
      oprot.writeI64(self.amount)
      oprot.writeFieldEnd()
    if self.returnTimestamp is not None:
      oprot.writeFieldBegin('returnTimestamp', TType.I64, 4)
      oprot.writeI64(self.returnTimestamp)
      oprot.writeFieldEnd()
    if self.isSettled is not None:
      oprot.writeFieldBegin('isSettled', TType.BOOL, 5)
      oprot.writeBool(self.isSettled)
      oprot.writeFieldEnd()
    if self.type is not None:
      oprot.writeFieldBegin('type', TType.I32, 6)
      oprot.writeI32(self.type)
      oprot.writeFieldEnd()
    if self.returnInventoryType is not None:
      oprot.writeFieldBegin('returnInventoryType', TType.I32, 7)
      oprot.writeI32(self.returnInventoryType)
      oprot.writeFieldEnd()
    if self.currentSettlementType is not None:
      oprot.writeFieldBegin('currentSettlementType', TType.I32, 8)
      oprot.writeI32(self.currentSettlementType)
      oprot.writeFieldEnd()
    if self.latestSettlementDate is not None:
      oprot.writeFieldBegin('latestSettlementDate', TType.I64, 9)
      oprot.writeI64(self.latestSettlementDate)
      oprot.writeFieldEnd()
    if self.purchaseReturnType is not None:
      oprot.writeFieldBegin('purchaseReturnType', TType.I32, 10)
      oprot.writeI32(self.purchaseReturnType)
      oprot.writeFieldEnd()
    if self.reasonText is not None:
      oprot.writeFieldBegin('reasonText', TType.STRING, 11)
      oprot.writeString(self.reasonText)
      oprot.writeFieldEnd()
    if self.documentNumber is not None:
      oprot.writeFieldBegin('documentNumber', TType.STRING, 12)
      oprot.writeString(self.documentNumber)
      oprot.writeFieldEnd()
    if self.createdBy is not None:
      oprot.writeFieldBegin('createdBy', TType.STRING, 13)
      oprot.writeString(self.createdBy)
      oprot.writeFieldEnd()
    if self.unsettledAmount is not None:
      oprot.writeFieldBegin('unsettledAmount', TType.I64, 14)
      oprot.writeI64(self.unsettledAmount)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PurchaseReturnSettlement:
  """
  Attributes:
   - purchaseReturnId
   - settlementType
   - settlementAmount
   - settlementDate
   - settlementBy
   - documentNumber
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'purchaseReturnId', None, None, ), # 1
    (2, TType.I32, 'settlementType', None, None, ), # 2
    (3, TType.I64, 'settlementAmount', None, None, ), # 3
    (4, TType.I64, 'settlementDate', None, None, ), # 4
    (5, TType.STRING, 'settlementBy', None, None, ), # 5
    (6, TType.STRING, 'documentNumber', None, None, ), # 6
  )

  def __init__(self, purchaseReturnId=None, settlementType=None, settlementAmount=None, settlementDate=None, settlementBy=None, documentNumber=None,):
    self.purchaseReturnId = purchaseReturnId
    self.settlementType = settlementType
    self.settlementAmount = settlementAmount
    self.settlementDate = settlementDate
    self.settlementBy = settlementBy
    self.documentNumber = documentNumber

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.purchaseReturnId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I32:
          self.settlementType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.settlementAmount = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.settlementDate = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.settlementBy = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.documentNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PurchaseReturnSettlement')
    if self.purchaseReturnId is not None:
      oprot.writeFieldBegin('purchaseReturnId', TType.I64, 1)
      oprot.writeI64(self.purchaseReturnId)
      oprot.writeFieldEnd()
    if self.settlementType is not None:
      oprot.writeFieldBegin('settlementType', TType.I32, 2)
      oprot.writeI32(self.settlementType)
      oprot.writeFieldEnd()
    if self.settlementAmount is not None:
      oprot.writeFieldBegin('settlementAmount', TType.I64, 3)
      oprot.writeI64(self.settlementAmount)
      oprot.writeFieldEnd()
    if self.settlementDate is not None:
      oprot.writeFieldBegin('settlementDate', TType.I64, 4)
      oprot.writeI64(self.settlementDate)
      oprot.writeFieldEnd()
    if self.settlementBy is not None:
      oprot.writeFieldBegin('settlementBy', TType.STRING, 5)
      oprot.writeString(self.settlementBy)
      oprot.writeFieldEnd()
    if self.documentNumber is not None:
      oprot.writeFieldBegin('documentNumber', TType.STRING, 6)
      oprot.writeString(self.documentNumber)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class Invoice:
  """
  Attributes:
   - id
   - invoiceNumber
   - date
   - numItems
   - receivedFrom
   - supplierId
   - warehouseId
   - invoiceDate
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.STRING, 'invoiceNumber', None, None, ), # 2
    (3, TType.I64, 'date', None, None, ), # 3
    (4, TType.I64, 'numItems', None, None, ), # 4
    (5, TType.STRING, 'receivedFrom', None, None, ), # 5
    (6, TType.I64, 'supplierId', None, None, ), # 6
    (7, TType.I64, 'warehouseId', None, None, ), # 7
    (8, TType.I64, 'invoiceDate', None, None, ), # 8
  )

  def __init__(self, id=None, invoiceNumber=None, date=None, numItems=None, receivedFrom=None, supplierId=None, warehouseId=None, invoiceDate=None,):
    self.id = id
    self.invoiceNumber = invoiceNumber
    self.date = date
    self.numItems = numItems
    self.receivedFrom = receivedFrom
    self.supplierId = supplierId
    self.warehouseId = warehouseId
    self.invoiceDate = invoiceDate

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.invoiceNumber = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.date = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.numItems = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.receivedFrom = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.I64:
          self.supplierId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.I64:
          self.warehouseId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.I64:
          self.invoiceDate = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('Invoice')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.invoiceNumber is not None:
      oprot.writeFieldBegin('invoiceNumber', TType.STRING, 2)
      oprot.writeString(self.invoiceNumber)
      oprot.writeFieldEnd()
    if self.date is not None:
      oprot.writeFieldBegin('date', TType.I64, 3)
      oprot.writeI64(self.date)
      oprot.writeFieldEnd()
    if self.numItems is not None:
      oprot.writeFieldBegin('numItems', TType.I64, 4)
      oprot.writeI64(self.numItems)
      oprot.writeFieldEnd()
    if self.receivedFrom is not None:
      oprot.writeFieldBegin('receivedFrom', TType.STRING, 5)
      oprot.writeString(self.receivedFrom)
      oprot.writeFieldEnd()
    if self.supplierId is not None:
      oprot.writeFieldBegin('supplierId', TType.I64, 6)
      oprot.writeI64(self.supplierId)
      oprot.writeFieldEnd()
    if self.warehouseId is not None:
      oprot.writeFieldBegin('warehouseId', TType.I64, 7)
      oprot.writeI64(self.warehouseId)
      oprot.writeFieldEnd()
    if self.invoiceDate is not None:
      oprot.writeFieldBegin('invoiceDate', TType.I64, 8)
      oprot.writeI64(self.invoiceDate)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class PurchaseServiceException(Exception):
  """
  Attributes:
   - exceptionType
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'exceptionType', None, None, ), # 1
    (2, TType.STRING, 'message', None, None, ), # 2
  )

  def __init__(self, exceptionType=None, message=None,):
    self.exceptionType = exceptionType
    self.message = message

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.exceptionType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PurchaseServiceException')
    if self.exceptionType is not None:
      oprot.writeFieldBegin('exceptionType', TType.I32, 1)
      oprot.writeI32(self.exceptionType)
      oprot.writeFieldEnd()
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 2)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)