|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +from datetime import date |
| 4 | +from ....row import Row |
| 5 | +from ....characterType import numeric, alphaNumeric |
| 6 | + |
| 7 | + |
| 8 | +class SegmentJ: |
| 9 | + |
| 10 | + def __init__(self): |
| 11 | + self.content = " " * 240 |
| 12 | + self.defaultValues() |
| 13 | + |
| 14 | + def defaultValues(self): |
| 15 | + structs = [ |
| 16 | + ( 7, 8, 1, numeric, "3"), # TIPO DE REGISTRO |
| 17 | + ( 8, 13, 5, numeric, 1), # INDEX DO REGISTRO |
| 18 | + ( 13, 14, 1, alphaNumeric, "J"), # CÓDIGO DE SEGMENTO |
| 19 | + ( 14, 17, 3, numeric, "000"), # TIPO DE MOVIMENTO |
| 20 | + (144, 152, 8, numeric, date.today().strftime("%d%m%Y")), |
| 21 | + (114, 144, 23, numeric, "0"), |
| 22 | + (167, 182, 15, numeric, "0"), |
| 23 | + ] |
| 24 | + self.content = Row.setStructs(structs=structs, content=self.content) |
| 25 | + |
| 26 | + def setSenderBank(self, bank): |
| 27 | + structs = [ |
| 28 | + (0, 3, 3, numeric, bank.bankId), |
| 29 | + ] |
| 30 | + self.content = Row.setStructs(structs=structs, content=self.content) |
| 31 | + |
| 32 | + def setBarCode(self, barCode): |
| 33 | + structs = [ |
| 34 | + ( 17, 20, 3, numeric, barCode.bankId), |
| 35 | + ( 20, 21, 1, numeric, barCode.currency), |
| 36 | + ( 21, 22, 1, numeric, barCode.dac), |
| 37 | + ( 22, 26, 4, numeric, barCode.dueFactor), |
| 38 | + ( 26, 36, 10, numeric, barCode.amount), |
| 39 | + ( 36, 61, 25, numeric, barCode.freeField), |
| 40 | + ( 99, 114, 15, numeric, barCode.amount), # VALOR NOMINAL DO TÍTULO |
| 41 | + (152, 167, 15, numeric, barCode.amount), # VALOR DO PAGAMENTO |
| 42 | + ( 91, 99, 8, numeric, barCode.dueDate.strftime("%d%m%Y")), # DATA DE VENCIMENTO |
| 43 | + ] |
| 44 | + self.content = Row.setStructs(structs=structs, content=self.content) |
| 45 | + |
| 46 | + def setScheduleDate(self, date): |
| 47 | + structs = [ |
| 48 | + (144, 152, 8, numeric, date) |
| 49 | + ] |
| 50 | + self.content = Row.setStructs(structs=structs, content=self.content) |
| 51 | + |
| 52 | + def setIdentifier(self, identifier): |
| 53 | + structs = [ |
| 54 | + (182, 202, 20, alphaNumeric, identifier), |
| 55 | + ] |
| 56 | + self.content = Row.setStructs(structs=structs, content=self.content) |
| 57 | + |
| 58 | + def setPositionInLot(self, index): |
| 59 | + structs = [ |
| 60 | + (3, 7, 4, numeric, index) |
| 61 | + ] |
| 62 | + self.content = Row.setStructs(structs=structs, content=self.content) |
0 commit comments