예제 #1
0
    def _report_xls_template(self):
        from openerp.addons.report_xls.utils import rowcol_to_cell, _render
        global anio, date_to
        fecha_desde = date_to
        spli_date_to = fecha_desde.split('-')
        ultimo_dia = calendar.monthrange(int(anio), int(spli_date_to[1]))
        desde = date(int(fecha_desde[0:4]), int(fecha_desde[5:7]), int(1))
        hasta = date(int(fecha_desde[0:4]), int(fecha_desde[5:7]),
                     int(ultimo_dia[1]))
        dias_totales = (hasta - desde).days
        # em = general_nominas_empleados.probando_empleados()
        # for e in em:
        #     abc = e['name_related']
        # print (_render("codigo_dias or ''"))
        my_change = {
            'empleado': {
                'header': [1, 50, 'text', _render("_('')")],
                'lines': [1, 0, 'text', _render("abc")]
            },
        }
        for t in range(int(dias_totales) + 1):
            fecha = desde + relativedelta(days=t)
            dia_str = datetime.datetime.strptime(
                str(fecha),
                '%Y-%m-%d').strftime('%a').upper().decode('latin-1')
            # letras_dia = self.elimina_tildes(str(dia_str).decode('utf-8'))

            my_change[str(t)] = {
                'header': [1, 7, 'text',
                           _render("_('" + str(dia_str) + "')")],
                'lines': [1, 0, 'text',
                          _render("codigo_dias or ''")]
            }
        return my_change
    def __init__(self, name, table, rml=False, parser=False, header=False,
                 store=False):
        super(op_crm_employee_performance_analysis_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill_grey'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_left = xlwt.easyxf(rh_cell_format + _xs['left'])
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(
            aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Column Spec
        self.col_specs_template = {
            'id': {
                'header': [1, 8, 'text', _render("'ID'")],
                'lines': [1, 0, 'number', _render("(line['id'] )")],
                'totals': [1, 0, 'text', None]},
            'code': {
                'header': [2, 8, 'text', _render("'Code'")],
                'lines': [2, 0, 'text', _render("(str(line['code']) or '-')")],
                'totals': [2, 0, 'text', None]},
            'name': {
                'header': [2, 8, 'text', _render("'Name'")],
                'lines': [2, 0, 'text', _render("(str(line['name']) or '-')")],
                'totals': [2, 0, 'text', None]},
            'leads': {
                'header': [2, 8, 'text', _render("'No.Of Inquiries'")],
                'lines': [2, 0, 'number', _render("(line['leads'])")],
                'totals': [2, 0, 'text', None]},
            'enrollments': {
                'header': [2, 8, 'text', _render("'No.Of Enrolled'")],
                'lines': [2, 0, 'number', _render("(line['enrollments'] )")],
                'totals': [2, 0, 'text', None]},

        }

        self.wanted_list = ['id', 'code', 'name', 'leads', 'enrollments'
        ]
    def __init__(self, name, table, rml=False, parser=False, header=False,
                 store=False):
        super(op_enrollment_analysis_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(
            aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        #  Column Spec
        self.col_specs_template = {
            'batch_code': {
                'header': [2, 8, 'text', _render("'Batch CODE'")],
                'lines': [2, 0, 'text', _render("(str(line['batch_code']) or '-')")],
                'totals': [2, 0, 'text', None]},
            'name': {
                'header': [2, 8, 'text', _render("'Batch NAME'")],
                'lines': [2, 0, 'text', _render("(str(line['name']) or '-')")],
                'totals': [2, 0, 'text', None]},
            'std_code': {
                'header': [3, 8, 'text', _render("'Study Programme CODE'")],
                'lines': [3, 0, 'text', _render("(str(line['std_code']) or '-')")],
                'totals': [3, 0, 'text', None]},
            'std_name': {
                'header': [3, 8, 'text', _render("'Study Programme NAME'")],
                'lines': [3, 0, 'text', _render("(str(line['std_name']) or '-')")],
                'totals': [3, 0, 'text', None]},
            'enrollments': {
                'header': [2, 8, 'text', _render("'Enrollments'")],
                'lines': [2, 0, 'number', _render("(line['enrollments'])")],
                'totals': [2, 0, 'text', None]},
        }

        self.wanted_list = ['batch_code', 'name', 'std_code', 'std_name', 'enrollments']
예제 #4
0
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(dipes_xls, self).__init__(
            name, table, rml, parser, header, store)

        # XLS Template Journal Items
        self.col_specs_lines_template = {
            'move_name': {
                'header': [1, 20, 'text', _render("_('Entry')")],
                'lines': [1, 0, 'text', _render("GOGO")]}
        }
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(StockHistoryXls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + \
            _xs['borders_all'] + _xs['right']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        self.rh_cell_style_date = xlwt.easyxf(
            rh_cell_format, num_format_str=report_xls.date_format)
        # lines
        line_cell_format = _xs['borders_all']
        self.line_cell_style_decimal = xlwt.easyxf(
            line_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.line_cell_style = xlwt.easyxf(line_cell_format)

        self.col_specs_template = {
            'fiscal_classification_id': {
                'header': [1, 10, 'text', _render("('NCM')")],
                'lines': [1, 0, 'text',
                          _render("line.get('fiscal_classification_id', '')")],
                'totals': [1, 0, 'text', None]},
            'product_id': {
                'header': [1, 50, 'text', _render("('Produto')")],
                'lines': [1, 0, 'text',
                          _render("line.get('product_id', False) and "
                                  "line.get('product_id')[1] or ''")],
                'totals': [1, 0, 'text', None]},
            'price_unit_on_quant': {
                'header': [1, 25, 'text',
                           _render("('Preço de custo no periodo')")],
                'lines': [1, 0, 'number',
                          _render("line.get('price_unit_on_quant')"),
                          None, self.line_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'quantity': {
                'header': [1, 15, 'text', _render("('Quantidade')")],
                'lines': [1, 0, 'number', _render("line.get('quantity', 0)")],
                'totals': [1, 0, 'text', None]},
            'inventory_value': {
                'header': [1, 15, 'text', _render("('Valor Total')")],
                'lines': [1, 0, 'number',
                          _render("line.get('inventory_value', 0)"),
                          None, self.line_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
        }
예제 #6
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(res_partner_xls, self).__init__(name, table, rml, parser, header,
                                              store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format +
                                                 _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.col_specs_template = {
            'name': {
                'header': [1, 20, 'text',
                           _render("_('Customer Name')")],
                'lines': [1, 0, 'text',
                          _render("line.name or ''")],
                'totals': [1, 0, 'text', None]
            },
            'street': {
                'header': [1, 42, 'text',
                           _render("_('Address')")],
                'lines': [1, 0, 'text',
                          _render("line.street or ''")],
                'totals': [1, 0, 'text', None]
            },
            'mobile': {
                'header': [1, 42, 'text',
                           _render("_('Mobile')")],
                'lines': [1, 0, 'text',
                          _render("line.mobile or ''")],
                'totals': [1, 0, 'text', None]
            },
        }
 def _report_xls_template(self):
     update = super(AccountMoveLine, self).\
         _report_xls_template()
     update['cost_center_name'] = {
         'header': [1, 25, 'text', _('Cost Center')],
         'lines': [
             1, 0, 'text',
             _render("line.cost_center_id and "
                     "line.cost_center_id.name "
                     "or ''")
         ],
         'totals': [1, 0, 'text', None]
     }
     return update
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(report_xls, self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(aml_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template = {
                                   
            'col1': {
                'header': [1, 30, 'text', _render("_('Employee')")],
                'lines': [1, 0, 'text', _render("user_name or ''")],
                'totals': [1, 0, 'text', None]},    
            'col2': {
                'header': [1, 30, 'text', _render("_('Manager')")],
                'lines': [1,0, 'text', _render("employee_manager")],
                'totals': [1, 0, 'text', None]},                               
            'col3': {
                'header': [1, 24, 'text', _render("_('Department')")],
                'lines': [1, 0, 'text',  _render("employee_department")],
                'totals': [1,0, 'text', None]},                                                                                                                                  
            'col4': {
                'header': [1, 24, 'text', _render("_('HTML')")],
                'lines': [1, 0, 'text',  _render("html")],
                'totals': [1,0, 'text', None]},         
                  
        }
예제 #9
0
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(purchase_order_xls, self).__init__(  name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf( aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf( aml_cell_format + _xs['right'],  num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf( rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
        
        self.col_specs_template = {
            'name': {
                'header': [1, 12, 'text', _render("_('Item No.')")],
                'lines': [1, 0, 'text', _render("line.product_id.default_code or ''")] },
            'desc': {
                'header': [1, 42, 'text', _render("_('Description')")],
                'lines': [1, 0, 'text', _render("line.product_id.name_template or ''")] },
            'unit': {
                'header': [1, 20, 'text', _render("_('Unit of measure')")],
                'lines': [1, 0, 'text', _render("'PCS'")] },
            'product_qty': {
                'header': [1, 10, 'text', _render("_('Quantity')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("line.product_qty")] },
        }
예제 #10
0
 def _prepare_col_spec_lines_template(self):
     # This is needed for translate tool to catch correctly lang handled
     user = self.pool['res.users'].browse(self.cr, self.uid, self.uid)
     context = {}
     context.update({'lang': user.lang})
     # XLS Template
     # [Cell columns span, cell width, content type, ??]
     return {
         'name': {
             'header': [1, 80, 'text', _('Concept')],
             'lines': [1, 0, 'text', _render("l['name']")],
             'totals': [1, 0, 'text', None],
         },
         'code': {
             'header': [1, 10, 'text', _('Code')],
             'lines': [1, 0, 'text', _render("l['code']")],
             'totals': [1, 0, 'text', None],
         },
         'previous_value': {
             'header': [1, 15, 'text', _('Previous value'),
                        None, self.rh_cell_style_right],
             'lines': [1, 0, 'number', _render("l['previous_value']"),
                       None, self.aml_cell_style_decimal],
             'totals': [1, 0, 'text', None]
         },
         'current_value': {
             'header': [1, 15, 'text', _('Current value'),
                        None, self.rh_cell_style_right],
             'lines': [1, 0, 'number', _render("l['current_value']"),
                       None, self.aml_cell_style_decimal],
             'totals': [1, 0, 'text', None]
         },
         'balance': {
             'header': [1, 15, 'text', _('Balance'),
                        None, self.rh_cell_style_right],
             'lines': [1, 0, 'number', _render("l['balance']"),
                       None, self.aml_cell_style_decimal],
             'totals': [1, 0, 'text', None]
         },
         'notes': {
             'header': [1, 30, 'text', _('Notes')],
             'lines': [1, 0, 'text', _render("l['notes']")],
             'totals': [1, 0, 'text', None],
         },
     }
예제 #11
0
 def _report_xls_template(self, cr, uid, context=None):
     res = super(account_move_line,
                 self)._report_xls_template(cr, uid, context=context)
     bc = '22'
     aml_cell_style_date = xlwt.easyxf(
         'borders: left thin, right thin, top thin, bottom thin, '
         'left_colour %s, right_colour %s, top_colour %s, '
         'bottom_colour %s; align: horz left;' % (bc, bc, bc, bc),
         num_format_str=report_xls.date_format)
     res.update({
         'start_date': {
             'header': [1, 13, 'text',
                        _render("_('Start Date')")],
             'lines': [
                 1, 0,
                 _render(
                     "line.start_date and line.start_date != 'False' and "
                     "'date' or 'text'"),
                 _render(
                     "line.start_date and line.start_date != 'False' and "
                     "datetime.strptime(line.start_date, '%Y-%m-%d') or None"
                 ), None, aml_cell_style_date
             ],
             'totals': [1, 0, 'text', None]
         },
         'end_date': {
             'header': [1, 13, 'text',
                        _render("_('End Date')")],
             'lines': [
                 1, 0,
                 _render("line.end_date and line.end_date != 'False' and "
                         "'date' or 'text'"),
                 _render(
                     "line.end_date and line.end_date != 'False' and "
                     "datetime.strptime(line.end_date, '%Y-%m-%d') or None"
                 ), None, aml_cell_style_date
             ],
             'totals': [1, 0, 'text', None]
         },
     })
     return res
예제 #12
0
 def __init__(self,
              name,
              table,
              rml=False,
              parser=False,
              header=True,
              store=False):
     super(payroll_report_bank_xls, self).__init__(name, table, rml, parser,
                                                   header, store)
     # XLS Template Holidays Items
     self.col_specs_lines_template = {
         'total': {
             'lines': [1, 0, 'number',
                       _render("l['total']")],
             'totals': [1, 0, 'number', None]
         },
         'employee_code': {
             'lines': [1, 0, 'number',
                       _render("l['employee_code']")],
             'totals': [1, 0, 'number', None]
         },
         'employee_name': {
             'lines': [1, 0, 'text',
                       _render("l['employee_name']")],
             'totals': [1, 0, 'text', None]
         },
         'bank_name': {
             'lines': [1, 0, 'text',
                       _render("l['bank_name']")],
             'totals': [1, 0, 'text', None]
         },
         'name': {
             'lines': [1, 0, 'text', _render("l['name']")],
             'totals': [1, 0, 'text', None]
         },
         'no': {
             'lines': [1, 0, 'number', _render("l['no']")],
             'totals': [1, 0, 'number', None]
         },
     }
예제 #13
0
	def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
		super(res_partner_xls, self).__init__(name, table, rml, parser, header, store)

		# Cell Styles
		_xs = self.xls_styles
		# header
		rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
		self.rh_cell_style = xlwt.easyxf(rh_cell_format)
		self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
		self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
		# lines
		aml_cell_format = _xs['borders_all']
		self.aml_cell_style = xlwt.easyxf(aml_cell_format)
		self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
		self.aml_cell_style_date = xlwt.easyxf(aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
		self.aml_cell_style_decimal = xlwt.easyxf(aml_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
		# totals
		rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
		self.rt_cell_style = xlwt.easyxf(rt_cell_format)
		self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
		self.rt_cell_style_decimal = xlwt.easyxf(rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)	
		self.col_specs_template = {
            'name': {
                'header': [1, 20, 'text', _render("_('Customer Name')")],
                'lines': [1, 0, 'text', _render("line.name or ''")],
                'totals': [1, 0, 'text', None]},           
            'street': {
                'header': [1, 42, 'text', _render("_('Address')")],
                'lines': [1, 0, 'text', _render("line.street or ''")],
                'totals': [1, 0, 'text', None]},
	    'mobile': {
                'header': [1, 42, 'text', _render("_('Mobile')")],
                'lines': [1, 0, 'text', _render("line.mobile or ''")],
                'totals': [1, 0, 'text', None]},
            
	     
        }
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(CostControlSheetReportXls, self).__init__(
            name, table, rml, parser, header, store
        )

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Type view Column format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        av_cell_format = _xs['bold'] + fill_blue + _xs['borders_all']
        self.av_cell_style = xlwt.easyxf(av_cell_format)
        self.av_cell_style_decimal = xlwt.easyxf(
            av_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Type normal Column Data format
        an_cell_format = _xs['borders_all']
        self.an_cell_style = xlwt.easyxf(an_cell_format)
        self.an_cell_style_center = xlwt.easyxf(an_cell_format + _xs['center'])
        self.an_cell_style_date = xlwt.easyxf(
            an_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.an_cell_style_decimal = xlwt.easyxf(
            an_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.cost_control_sheet_template = {
            'name': {
                'quote': [1, 0, 'text', _render("quote_description")],
                'custom_group': [1, 0, 'text', _render("custom_group_name")],
                'section': [1, 0, 'text', _render("section_name")],
                'order_line': [
                    1, 0, 'text', _render("order_line_description"),
                    None, self.an_cell_style_date],
            },
            'price_in_contract': {
                'quote': [1, 0, 'text', None],
                'custom_group': [1, 0, 'text', None],
                'section': [1, 0, 'text', None],
                'order_line': [
                    1, 0, 'number', _render("price_in_contract"),
                    None, self.an_cell_style_decimal],
            },
            'estimate_cost': {
                'quote': [1, 0, 'text', None],
                'custom_group': [1, 0, 'text', None],
                'section': [1, 0, 'text', None],
                'order_line': [
                    1, 0, 'number', _render("estimate_cost"),
                    None, self.an_cell_style_decimal],
            },
            'percent_margin': {
                'quote': [1, 0, 'text', None],
                'custom_group': [1, 0, 'text', None],
                'section': [1, 0, 'text', None],
                'order_line': [1, 0, 'number', _render("percent_margin")],
            },
        }
예제 #15
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(bank_bookunpaid_report_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_center = xlwt.easyxf(ph_cell_format + _xs['center'])
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.fd_font_style = xlwt.easyxf('font: colour blue, bold True;')
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.pd_cell_style_decimal_fill = xlwt.easyxf(
            pd_cell_format + _xs['right'] + _xs['fill'] + _xs['bold'],
            num_format_str=report_xls.decimal_format)
        self.pd_cell_style_decimal_blue = xlwt.easyxf(
            'font: colour blue, bold True;' + pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        style = xlwt.XFStyle()
        pattern = xlwt.Pattern()
        pattern.pattern = xlwt.Pattern.SOLID_PATTERN
        pattern.pattern_fore_colour = xlwt.Style.colour_map['dark_purple']
        style.pattern = pattern

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [
                    1, 5, 'text',
                    _render("_('No')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['no']"), None, self.pd_cell_style_center
                ],
                'totals': [1, 5, 'text', None]
            },
            'branch_name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Branch')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['branch_name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'date': {
                'header': [
                    1, 15, 'text',
                    _render("_('Date')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 0, 'text', None]
            },
            # 'value_date': {
            #     'header': [1, 15, 'text', _render("_('Value Date')"),None,self.rh_cell_style_center],
            #     'lines': [1, 0, 'text', _render("p['value_date']")],
            #     'totals': [1, 0, 'text', None]},
            'partner_name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Partner')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['partner_name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'finance_company': {
                'header': [
                    1, 20, 'text',
                    _render("_('Finance Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['finance_company'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'account_code2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Account Code')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['account_code2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'account_name2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Account Name')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['account_name2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Description')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'giro': {
                'header': [
                    1, 20, 'text',
                    _render("_('Cek/Giro')"), None, self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['cheque_giro_number'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'ref': {
                'header': [
                    1, 20, 'text',
                    _render("_('Ref')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['ref'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'debit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Debit')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['debit'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'credit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Credit')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 20, 'number',
                    _render("p['credit'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'analytic_combination': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Combination')"), None,
                    self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['analytic_combination'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_1': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_1'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Bisnis Unit')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_3': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Branch')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_3'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_4': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Cost Center')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_4'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'state': {
                'header': [
                    1, 20, 'text',
                    _render("_('State')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['state'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'btr_type': {
                'header': [
                    1, 20, 'text',
                    _render("_('Tipe Bank Transfer')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['btr_type'] or ''")],
                'totals': [1, 0, 'text', None]
            },
        }

        # XLS Template
        self.col_specs_template_overview_blue = {
            'no': {
                'header': [
                    1, 5, 'text',
                    _render("_('No')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['no']"), None, self.pd_cell_style_center
                ],
                'totals': [1, 5, 'text', None]
            },
            'branch_name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Branch')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['branch_name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'date': {
                'header': [
                    1, 15, 'text',
                    _render("_('Date')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 0, 'text', None]
            },
            # 'value_date': {
            #     'header': [1, 15, 'text', _render("_('Value Date')"),None,self.rh_cell_style_center],
            #     'lines': [1, 0, 'text', _render("p['value_date']")],
            #     'totals': [1, 0, 'text', None]},
            'partner_name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Partner')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['partner_name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'finance_company': {
                'header': [
                    1, 20, 'text',
                    _render("_('Finance Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['finance_company'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'account_code2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Account Code')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['account_code2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'account_name2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Account Name')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['account_name2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Description')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'giro': {
                'header': [
                    1, 20, 'text',
                    _render("_('Cek/Giro')"), None, self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['cheque_giro_number'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'ref': {
                'header': [
                    1, 20, 'text',
                    _render("_('Ref')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['ref'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'debit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Debit')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['debit'] or ''"), None,
                    self.pd_cell_style_decimal_blue
                ],
                'totals': [1, 0, 'text', None]
            },
            'credit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Credit')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 20, 'number',
                    _render("p['credit'] or ''"), None,
                    self.pd_cell_style_decimal_blue
                ],
                'totals': [1, 0, 'text', None]
            },
            'analytic_combination': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Combination')"), None,
                    self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['analytic_combination'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_1': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_1'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Bisnis Unit')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_3': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Branch')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_3'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_4': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Cost Center')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_4'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'state': {
                'header': [
                    1, 20, 'text',
                    _render("_('State')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['state'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'btr_type': {
                'header': [
                    1, 20, 'text',
                    _render("_('Tipe Bank Transfer')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['btr_type'] or ''")],
                'totals': [1, 0, 'text', None]
            },
        }

        # XLS Template
        self.col_specs_template_details = {}
예제 #16
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(kas_besar_report_xls, self).__init__(name, table, rml, parser,
                                                   header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_center = xlwt.easyxf(ph_cell_format + _xs['center'])
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.pd_cell_style_decimal_fill = xlwt.easyxf(
            pd_cell_format + _xs['right'] + _xs['fill'] + _xs['bold'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [
                    1, 5, 'text',
                    _render("_('No')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['no']"), None, self.pd_cell_style_center
                ],
                'totals': [1, 5, 'text', None]
            },
            'hari': {
                'header': [
                    1, 15, 'text',
                    _render("_('Hari')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text', _render("p['hari']")],
                'totals': [1, 0, 'text', None]
            },
            'date': {
                'header': [
                    1, 15, 'text',
                    _render("_('Tanggal')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 0, 'text', None]
            },
            'saldo_awal': {
                'header': [
                    1, 20, 'text',
                    _render("_('Saldo Awal')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['saldo_awal'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'debit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Penambahan')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['debit'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'credit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Penyetoran')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 20, 'number',
                    _render("p['credit'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'saldo_akhir': {
                'header': [
                    1, 20, 'text',
                    _render("_('Saldo Akhir')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['saldo_akhir'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'lebih_setor': {
                'header': [
                    1, 20, 'text',
                    _render("_('Lebih Setor')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['lebih_setor'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'kurang_setor': {
                'header': [
                    1, 20, 'text',
                    _render("_('Kurang Setor')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['kurang_setor'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
        }

        # XLS Template
        self.col_specs_template_details = {}
예제 #17
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_distribusi_unit_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'text', _render("p['no']")],
                'totals': [1, 5, 'text', None]
            },
            'branch_name': {
                'header': [1, 22, 'text',
                           _render("_('Cabang')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_name']")],
                'totals': [1, 22, 'text', _render("_('Total')")]
            },
            'type_po': {
                'header': [1, 22, 'text',
                           _render("_('Tipe PO')")],
                'lines': [1, 0, 'text', _render("p['type_po']")],
                'totals': [1, 22, 'text', None]
            },
            'tgl_po': {
                'header': [1, 15, 'text',
                           _render("_('TGL PO')")],
                'lines': [1, 0, 'text', _render("p['tgl_po']")],
                'totals': [1, 15, 'text', None]
            },
            'no_po': {
                'header': [1, 22, 'text', _render("_('NO PO')")],
                'lines': [1, 0, 'text', _render("p['no_po']")],
                'totals': [1, 22, 'text', None]
            },
            'tipe_product': {
                'header': [1, 22, 'text',
                           _render("_('Tipe Produk')")],
                'lines': [1, 0, 'text',
                          _render("p['tipe_product']")],
                'totals': [1, 22, 'text', None]
            },
            'internal_reference': {
                'header': [1, 22, 'text',
                           _render("_('Produk Description')")],
                'lines': [1, 0, 'text',
                          _render("p['internal_reference']")],
                'totals': [1, 22, 'text', None]
            },
            'warna': {
                'header': [1, 22, 'text', _render("_('Warna')")],
                'lines': [1, 0, 'text', _render("p['warna']")],
                'totals': [1, 22, 'text', None]
            },
            'qty_po': {
                'header': [1, 22, 'text',
                           _render("_('DIST PLAN')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_po']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['qty_po']"), None, self.rt_cell_style_decimal
                ]
            },
            'qty_bpb': {
                'header': [1, 22, 'text',
                           _render("_('DIST ACTUAL')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_bpb']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['qty_bpb']"), None, self.rt_cell_style_decimal
                ]
            },
            'qty_sisa': {
                'header': [1, 22, 'text',
                           _render("_('OUTSTANDING')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_sisa']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['qty_sisa']"), None, self.rt_cell_style_decimal
                ]
            },
            'no_bpb': {
                'header': [1, 22, 'text',
                           _render("_('No GRN')")],
                'lines': [1, 0, 'text', _render("p['no_bpb']")],
                'totals': [1, 22, 'text', None]
            },
            'tgl_bpb': {
                'header': [1, 22, 'text',
                           _render("_('Tgl GRN')")],
                'lines': [1, 0, 'text', _render("p['tgl_bpb']")],
                'totals': [1, 22, 'text', None]
            },
            'division': {
                'header': [1, 22, 'text',
                           _render("_('Divisi')")],
                'lines': [1, 0, 'text', _render("p['division']")],
                'totals': [1, 22, 'text', None]
            },
        }

        # XLS Template
        self.col_specs_template_details = {}
예제 #18
0
        def _prepare_col_spec_lines_template(self, invoice_type=None):
            # This is needed for translate tool to catch correctly lang handled

            user = self.pool['res.users'].browse(self.cr, self.uid, self.uid)
            context = {}
            context.update({'lang': user.lang})

            # XLS Template
            # [Cell columns span, cell width, content type, ??]
            spec_lines_template = {}
            if invoice_type == 'out_invoice':
                spec_lines_template = {
                    'number': {
                        'header':
                        [1, 15, 'text',
                         _render("_('N de factura')")],
                        'lines': [1, 0, 'text',
                                  _render("l['number']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'date_invoice': {
                        'header':
                        [1, 20, 'text',
                         _render("_('Fecha factura')")],
                        'lines':
                        [1, 0, 'text',
                         _render("(l['date_invoice'])")],
                        'totals': [1, 0, 'text', None]
                    },
                    'partner_vat': {
                        'header': [1, 20, 'text',
                                   _render("_('Empresa/NIF')")],
                        'lines': [1, 0, 'text',
                                  _render("(l['partner_vat'])")],
                        'totals': [1, 0, 'text', None]
                    },
                    'partner_name': {
                        'header':
                        [1, 40, 'text',
                         _render("_('Empresa/Nombre')")],
                        'lines': [1, 0, 'text',
                                  _render("l['partner_name']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_base': {
                        'header':
                        [1, 20, 'text',
                         _render("_('Base imponible')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_base']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_amount': {
                        'header': [1, 20, 'text',
                                   _render("_('Cuota IVA')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_amount']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_percent': {
                        'header': [1, 20, 'text',
                                   _render("_('% IVA')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_percent']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_amount_rec': {
                        'header': [
                            1, 20, 'text',
                            _render("_('Recargo de equivalencia')")
                        ],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_amount_rec']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_amount_ret': {
                        'header': [1, 20, 'text',
                                   _render("_('Retenciones')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_amount_ret']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'amount_total': {
                        'header': [1, 20, 'text',
                                   _render("_('Total')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['amount_total']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'country_name': {
                        'header': [
                            1, 20, 'text',
                            _render("_('Empresa/País/Nombre del país')")
                        ],
                        'lines': [1, 0, 'text',
                                  _render("l['country_name']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_description': {
                        'header': [
                            1, 40, 'text',
                            _render(
                                "_('Líneas de impuestos/Descripción impuesto')"
                            )
                        ],
                        'lines':
                        [1, 0, 'text',
                         _render("l['tax_description']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'fiscal_name': {
                        'header': [
                            1, 40, 'text',
                            _render(
                                "_('Empresa/Posición fiscal/Posición fiscal')")
                        ],
                        'lines': [1, 0, 'text',
                                  _render("l['fiscal_name']")],
                        'totals': [1, 0, 'text', None]
                    },
                }
            elif invoice_type == 'in_invoice':
                spec_lines_template = {
                    'date_invoice': {
                        'header':
                        [1, 20, 'text',
                         _render("_('Fecha factura')")],
                        'lines':
                        [1, 0, 'text',
                         _render("(l['date_invoice'])")],
                        'totals': [1, 0, 'text', None]
                    },
                    'number': {
                        'header':
                        [1, 15, 'text',
                         _render("_('N de factura')")],
                        'lines': [1, 0, 'text',
                                  _render("l['number']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'supplier_number': {
                        'header': [
                            1, 15, 'text',
                            _render("_('N de factura del proveedor')")
                        ],
                        'lines':
                        [1, 0, 'text',
                         _render("l['supplier_number']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'partner_vat': {
                        'header': [1, 20, 'text',
                                   _render("_('Empresa/NIF')")],
                        'lines': [1, 0, 'text',
                                  _render("(l['partner_vat'])")],
                        'totals': [1, 0, 'text', None]
                    },
                    'partner_name': {
                        'header':
                        [1, 40, 'text',
                         _render("_('Empresa/Nombre')")],
                        'lines': [1, 0, 'text',
                                  _render("l['partner_name']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_base': {
                        'header':
                        [1, 20, 'text',
                         _render("_('Base imponible')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_base']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_description': {
                        'header': [
                            1, 40, 'text',
                            _render(
                                "_('Líneas de impuestos/Descripción impuesto')"
                            )
                        ],
                        'lines':
                        [1, 0, 'text',
                         _render("l['tax_description']")],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_amount': {
                        'header': [1, 20, 'text',
                                   _render("_('Cuota IVA')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_amount']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'tax_amount_ret': {
                        'header': [1, 20, 'text',
                                   _render("_('Retenciones')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['tax_amount_ret']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'amount_total': {
                        'header': [1, 20, 'text',
                                   _render("_('Total')")],
                        'lines': [
                            1, 0, 'number',
                            _render("l['amount_total']"), None,
                            self.aml_cell_style_decimal
                        ],
                        'totals': [1, 0, 'text', None]
                    },
                    'country_name': {
                        'header': [
                            1, 20, 'text',
                            _render("_('Empresa/País/Nombre del país')")
                        ],
                        'lines': [1, 0, 'text',
                                  _render("l['country_name']")],
                        'totals': [1, 0, 'text', None]
                    },
                }

            return spec_lines_template
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(report_stock_xls, self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        
        header_total_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        
        # Format Nomor
        self.number_style = xlwt.easyxf(_xs['center'])
        
        # Format Kolom Header
        self.column_header_style = xlwt.easyxf(header_total_format)
        
        # Format Kolom Data
        column_data_format = _xs['borders_all']
        self.column_data_style = xlwt.easyxf(column_data_format)
        self.column_data_style_date = xlwt.easyxf(column_data_format + _xs['left'], num_format_str=report_xls.date_format)
        self.column_data_style_decimal = xlwt.easyxf(column_data_format + _xs['right'], num_format_str=report_xls.decimal_format)
        
        # Format Total
        self.total_style = xlwt.easyxf(header_total_format)
        self.total_style_decimal = xlwt.easyxf(header_total_format + _xs['right'], num_format_str=report_xls.decimal_format)
        
        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'number', _render("p['no']"), None, self.number_style],
                'totals': [1, 5, 'number', None]},
            'product': {
                'header': [1, 35, 'text', _render("_('Product')")],
                'lines': [1, 0, 'text', _render("p['product']")],
                'totals': [1, 35, 'number', None]},
            'prod_categ': {
                'header': [1, 22, 'text', _render("_('Product Category')")],
                'lines': [1, 0, 'text', _render("p['prod_categ']")],
                'totals': [1, 22, 'number', None]},
            'location': {
                'header': [1, 40, 'text', _render("_('Location')")],
                'lines': [1, 0, 'text', _render("p['location']")],
                'totals': [1, 40, 'number', None]},
            'tgl_masuk': {
                'header': [1, 22, 'text', _render("_('Incoming Date')")],
                'lines': [1, 0, 'text', _render("p['tgl_masuk']")],
                'totals': [1, 22, 'number', None]},
            'aging': {
                'header': [1, 22, 'text', _render("_('Stock Age')")],
                'lines': [1, 0, 'number', _render("p['aging']"), None, self.column_data_style_decimal],
                'totals': [1, 22, 'number', None]},
            'total_product': {
                'header': [1, 22, 'text', _render("_('Total Product')")],
                'lines': [1, 0, 'number', _render("p['total_product']"), None, self.column_data_style_decimal],
                'totals': [1, 22, 'number', None]},
            'stock': {
                'header': [1, 22, 'text', _render("_('Stock')")],
                'lines': [1, 0, 'number', _render("p['stock']"), None, self.column_data_style_decimal],
                'totals': [1, 22, 'number', None]},
            'reserved': {
                'header': [1, 22, 'text', _render("_('Reserved')")],
                'lines': [1, 0, 'number', _render("p['reserved']"), None, self.column_data_style_decimal],
                'totals': [1, 22, 'number', None]},
        }
    def __init__(self, name, table, rml=False, parser=False, header=False,
                 store=False):
        super(op_followup_actions_detail_analysis_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(
            aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Column Spec
        self.col_specs_template = {
            'id': {
                'header': [1, 8, 'text', _render("'ID'")],
                'lines': [1, 0, 'number', _render("(line['id'] )")],
                'totals': [1, 0, 'text', None]},
            'first_name': {
                'header': [2, 10, 'text', _render("'First Name'")],
                'lines': [2, 0, 'text', _render("(str(line['first_name']) or '-')")],
                'totals': [2, 0, 'text', None]},
            'last_name': {
                'header': [2, 10, 'text', _render("'Last Name'")],
                'lines': [2, 0, 'text', _render("(str(line['last_name']) or '-')")],
                'totals': [2, 0, 'text', None]},
            'studypro_code': {
                'header': [2, 8, 'text', _render("'Study Programme Code'")],
                'lines': [2, 0, 'number', _render("(line['studypro_code'])")],
                'totals': [2, 0, 'text', None]},
            'studypro_name': {
                'header': [2, 8, 'text', _render("'Study Programme Name'")],
                'lines': [2, 0, 'number', _render("(line['studypro_name'] )")],
                'totals': [2, 0, 'text', None]},
            'status': {
                'header': [2, 8, 'text', _render("'Status'")],
                'lines': [2, 0, 'number', _render("(line['status'])")],
                'totals': [2, 0, 'text', None]},

        }

        self.wanted_list = ['id', 'first_name', 'last_name', 'studypro_code', 'studypro_name','status']
예제 #21
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_pembelian_sum_xls, self).__init__(name, table, rml,
                                                       parser, header, store)

        # Cell Styles
        _xs = self.xls_styles

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('NO')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'number', None]
            },
            'branch_code': {
                'header': [1, 22, 'text',
                           _render("_('Branch Code')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_code']")],
                'totals': [1, 22, 'text', _render("_('Total')")]
            },
            'branch_name': {
                'header': [1, 22, 'text',
                           _render("_('Branch Name')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_name']")],
                'totals': [1, 22, 'number', None]
            },
            'supplier': {
                'header': [1, 22, 'text',
                           _render("_('Supplier')")],
                'lines': [1, 0, 'text', _render("p['supplier']")],
                'totals': [1, 22, 'number', None]
            },
            'qty_beli_gross': {
                'header': [1, 22, 'text',
                           _render("_('Qty Beli Gross')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_beli_gross']")],
                'totals': [1, 22, 'number', None]
            },
            'qty_retur': {
                'header': [1, 22, 'text',
                           _render("_('Qty Retur')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_retur']")],
                'totals': [1, 22, 'number', None]
            },
            'qty_beli_net': {
                'header': [1, 22, 'text',
                           _render("_('Qty Beli Net')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_beli_net']")],
                'totals': [1, 22, 'number', None]
            },
        }
예제 #22
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(bank_book_report_xls, self).__init__(name, table, rml, parser,
                                                   header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_center = xlwt.easyxf(ph_cell_format + _xs['center'])
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.pd_cell_style_decimal_fill = xlwt.easyxf(
            pd_cell_format + _xs['right'] + _xs['fill'] + _xs['bold'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [
                    1, 5, 'text',
                    _render("_('No')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['no']"), None, self.pd_cell_style_center
                ],
                'totals': [1, 5, 'text', None]
            },
            'branch_name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Branch')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['branch_name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'date': {
                'header': [
                    1, 15, 'text',
                    _render("_('Date')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 0, 'text', None]
            },
            # 'value_date': {
            #     'header': [1, 15, 'text', _render("_('Value Date')"),None,self.rh_cell_style_center],
            #     'lines': [1, 0, 'text', _render("p['value_date']")],
            #     'totals': [1, 0, 'text', None]},
            'partner_code': {
                'header': [
                    1, 20, 'text',
                    _render("_('Kode Partner')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['partner_code'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'partner_name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Partner')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['partner_name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'cabang': {
                'header': [
                    1, 20, 'text',
                    _render("_('Cabang')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['cabang'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'finance_company': {
                'header': [
                    1, 20, 'text',
                    _render("_('Finance Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['finance_company'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'account_code2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Account Code')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['account_code2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'account_name2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Account Name')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['account_name2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'name': {
                'header': [
                    1, 20, 'text',
                    _render("_('Description')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['name'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'jurnal_item': {
                'header': [
                    1, 20, 'text',
                    _render("_('Jurnal Item')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['jurnal_item'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'giro': {
                'header': [
                    1, 20, 'text',
                    _render("_('Cek/Giro')"), None, self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['cheque_giro_number'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'ref': {
                'header': [
                    1, 20, 'text',
                    _render("_('Ref')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['ref'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'kas_bon': {
                'header': [
                    1, 20, 'text',
                    _render("_('Kas Bon (PCO)')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['kas_bon'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'debit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Debit')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'number',
                    _render("p['debit'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'credit': {
                'header': [
                    1, 20, 'text',
                    _render("_('Credit')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 20, 'number',
                    _render("p['credit'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'cur_balance': {
                'header': [
                    1, 20, 'text',
                    _render("_('Current Balance')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [
                    1, 20, 'number',
                    _render("p['cur_balance'] or ''"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'analytic_combination': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Combination')"), None,
                    self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['analytic_combination'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_1': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_1'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Bisnis Unit')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_3': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Branch')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_3'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_4': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Cost Center')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_4'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'state': {
                'header': [
                    1, 20, 'text',
                    _render("_('State')"), None, self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['state'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'btr_type': {
                'header': [
                    1, 20, 'text',
                    _render("_('Tipe Bank Transfer')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['btr_type'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'source_of_fund': {
                'header': [
                    1, 20, 'text',
                    _render("_('Source Of Fund')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['source_of_fund'] or ''")],
                'totals': [1, 0, 'text', None]
            },
        }

        # XLS Template
        self.col_specs_template_details = {}
예제 #23
0
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(move_line_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(
            aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template = {
            'move': {
                'header': [1, 20, 'text', _render("_('Entry')")],
                'lines': [1, 0, 'text', _render("line.move_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'name': {
                'header': [1, 42, 'text', _render("_('Name')")],
                'lines': [1, 0, 'text', _render("line.name or ''")],
                'totals': [1, 0, 'text', None]},
            'ref': {
                'header': [1, 42, 'text', _render("_('Reference')")],
                'lines': [1, 0, 'text', _render("line.ref or ''")],
                'totals': [1, 0, 'text', None]},
            'date': {
                'header': [1, 13, 'text', _render("_('Effective Date')")],
                'lines': [1, 0, 'date',
                          _render("datetime.strptime(line.date,'%Y-%m-%d')"),
                          None, self.aml_cell_style_date],
                'totals': [1, 0, 'text', None]},
            'period': {
                'header': [1, 12, 'text', _render("_('Period')")],
                'lines':
                [1, 0, 'text',
                 _render("line.period_id.code or line.period_id.name")],
                'totals': [1, 0, 'text', None]},
            'partner': {
                'header': [1, 36, 'text', _render("_('Partner')")],
                'lines':
                [1, 0, 'text',
                 _render("line.partner_id and line.partner_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'partner_ref': {
                'header': [1, 36, 'text', _render("_('Partner Reference')")],
                'lines':
                [1, 0, 'text',
                 _render("line.partner_id and line.partner_id.ref or ''")],
                'totals': [1, 0, 'text', None]},
            'account': {
                'header': [1, 12, 'text', _render("_('Account')")],
                'lines': [1, 0, 'text', _render("line.account_id.code")],
                'totals': [1, 0, 'text', None]},
            'date_maturity': {
                'header': [1, 13, 'text', _render("_('Maturity Date')")],
                'lines':
                [1, 0,
                 _render("line.date_maturity and 'date' or 'text'"),
                 _render(
                     "line.date_maturity"
                     " and datetime.strptime(line.date_maturity,'%Y-%m-%d')"
                     " or None"),
                    None, self.aml_cell_style_date],
                'totals': [1, 0, 'text', None]},
            'debit': {
                'header': [1, 18, 'text', _render("_('Debit')"), None,
                           self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("line.debit"), None,
                          self.aml_cell_style_decimal],
                'totals': [1, 0, 'number', None, _render("debit_formula"),
                           self.rt_cell_style_decimal]},
            'credit': {
                'header': [1, 18, 'text', _render("_('Credit')"), None,
                           self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("line.credit"), None,
                          self.aml_cell_style_decimal],
                'totals': [1, 0, 'number', None, _render("credit_formula"),
                           self.rt_cell_style_decimal]},
            'balance': {
                'header': [1, 18, 'text', _render("_('Balance')"), None,
                           self.rh_cell_style_right],
                'lines': [1, 0, 'number', None, _render("bal_formula"),
                          self.aml_cell_style_decimal],
                'totals': [1, 0, 'number', None, _render("bal_formula"),
                           self.rt_cell_style_decimal]},
            'reconcile': {
                'header': [1, 12, 'text', _render("_('Rec.')"), None,
                           self.rh_cell_style_center],
                'lines': [1, 0, 'text',
                          _render("line.reconcile_id.name or ''"), None,
                          self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'reconcile_partial': {
                'header': [1, 12, 'text', _render("_('Part. Rec.')"), None,
                           self.rh_cell_style_center],
                'lines': [1, 0, 'text',
                          _render("line.reconcile_partial_id.name or ''"),
                          None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'tax_code': {
                'header': [1, 12, 'text', _render("_('Tax Code')"), None,
                           self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("line.tax_code_id.code or ''"),
                          None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'tax_amount': {
                'header': [1, 18, 'text', _render("_('Tax/Base Amount')"),
                           None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("line.tax_amount"), None,
                          self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'amount_currency': {
                'header': [1, 18, 'text', _render("_('Am. Currency')"), None,
                           self.rh_cell_style_right],
                'lines':
                [1, 0,
                 _render("line.amount_currency and 'number' or 'text'"),
                 _render("line.amount_currency or None"),
                 None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'currency_name': {
                'header': [1, 6, 'text', _render("_('Curr.')"), None,
                           self.rh_cell_style_center],
                'lines':
                [1, 0, 'text',
                 _render("line.currency_id and line.currency_id.name or ''"),
                 None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'journal': {
                'header': [1, 12, 'text', _render("_('Journal')")],
                'lines': [1, 0, 'text', _render("line.journal_id.code or ''")],
                'totals': [1, 0, 'text', None]},
            'company_currency': {
                'header': [1, 10, 'text', _render("_('Comp. Curr.')")],
                'lines': [1, 0, 'text',
                          _render("line.company_id.currency_id.name or ''"),
                          None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'analytic_account': {
                'header': [1, 36, 'text', _render("_('Analytic Account')")],
                'lines': [1, 0, 'text',
                          _render("line.analytic_account_id.code or ''")],
                'totals': [1, 0, 'text', None]},
            'product': {
                'header': [1, 36, 'text', _render("_('Product')")],
                'lines': [1, 0, 'text', _render("line.product_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'product_ref': {
                'header': [1, 36, 'text', _render("_('Product Reference')")],
                'lines': [1, 0, 'text',
                          _render("line.product_id.default_code or ''")],
                'totals': [1, 0, 'text', None]},
            'product_uom': {
                'header': [1, 20, 'text', _render("_('Unit of Measure')")],
                'lines': [1, 0, 'text',
                          _render("line.product_uom_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'quantity': {
                'header': [1, 8, 'text', _render("_('Qty')"), None,
                           self.rh_cell_style_right],
                'lines': [1, 0,
                          _render("line.quantity and 'number' or 'text'"),
                          _render("line.quantity or None"), None,
                          self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'statement': {
                'header': [1, 20, 'text', _render("_('Statement')")],
                'lines':
                [1, 0, 'text',
                 _render("line.statement_id and line.statement_id.name or ''")
                 ],
                'totals': [1, 0, 'text', None]},
            'invoice': {
                'header': [1, 20, 'text', _render("_('Invoice')")],
                'lines':
                [1, 0, 'text',
                 _render("line.invoice and line.invoice.number or ''")],
                'totals': [1, 0, 'text', None]},
            'amount_residual': {
                'header': [1, 18, 'text', _render("_('Residual Amount')"),
                           None, self.rh_cell_style_right],
                'lines':
                [1, 0,
                 _render("line.amount_residual and 'number' or 'text'"),
                 _render("line.amount_residual or None"),
                 None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'amount_residual_currency': {
                'header': [1, 18, 'text', _render("_('Res. Am. in Curr.')"),
                           None, self.rh_cell_style_right],
                'lines':
                [1, 0,
                 _render(
                     "line.amount_residual_currency and 'number' or 'text'"),
                 _render("line.amount_residual_currency or None"),
                 None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'narration': {
                'header': [1, 42, 'text', _render("_('Notes')")],
                'lines': [1, 0, 'text',
                          _render("line.move_id.narration or ''")],
                'totals': [1, 0, 'text', None]},
            'blocked': {
                'header': [1, 4, 'text', _('Lit.'),
                           None, self.rh_cell_style_right],
                'lines': [1, 0, 'text', _render("line.blocked and 'x' or ''"),
                          None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
        }
예제 #24
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_lbb_xls, self).__init__(name, table, rml, parser, header,
                                             store)

        # Cell Styles
        _xs = self.xls_styles

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_right = xlwt.easyxf(pd_cell_format + _xs['right'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', None],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'number', None]
            },
            'type': {
                'header': [1, 22, 'text', None],
                'lines': [1, 0, 'text', _render("p['type']")],
                'totals': [1, 22, 'number', None]
            },
            'total_unit_entry': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['total_unit_entry']"), None,
                    self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'kpb_1': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['kpb_1']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'kpb_2': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['kpb_2']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'kpb_3': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['kpb_3']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'kpb_4': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['kpb_4']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'kpb_5': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['kpb_5']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'claim': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['claim']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'qs_cs': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['qs_cs']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'qs_ls': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['qs_ls']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'qs_or': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['qs_or']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'lr': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['lr']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'hr': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['hr']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'total': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['total']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'jr': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['jr']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'member_card': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['member_card']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'drive_thru': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['drive_thru']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
            'unit_safety': {
                'header': [1, 5, 'text', None],
                'lines': [
                    1, 0, 'number',
                    _render("p['unit_safety']"), None, self.pd_cell_style_right
                ],
                'totals': [1, 5, 'number', None]
            },
        }
예제 #25
0
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(invoice_line_xls, self).__init__(
            name, table, rml=rml, parser=parser, header=header, store=store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(
            rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(
            rh_cell_format + _xs['right'])
        # lines
        ail_cell_format = _xs['borders_all']
        self.ail_cell_style = xlwt.easyxf(ail_cell_format)
        self.ail_cell_style_center = xlwt.easyxf(
            ail_cell_format + _xs['center'])
        self.ail_cell_style_date = xlwt.easyxf(
            ail_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.ail_cell_style_decimal = xlwt.easyxf(
            ail_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(
            rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template = {
            'invoice_number': {
                'header': [1, 16, 'text', _render("_('Invoice Number')")],
                'lines': [1, 0, 'text', _render("line.invoice_number or ''")],
                'totals': [1, 0, 'text', None]},
            'invoice_type': {
                'header': [1, 13, 'text', _render("_('Invoice Type')")],
                'lines': [1, 0, 'text', _render("line.invoice_type or ''")],
                'totals': [1, 0, 'text', None]},
            'invoice_state': {
                'header': [1, 13, 'text', _render("_('Invoice State')")],
                'lines': [1, 0, 'text', _render("line.invoice_state or ''")],
                'totals': [1, 0, 'text', None]},
            'journal': {
                'header': [1, 9, 'text', _render("_('Journal')")],
                'lines': [1, 0, 'text',
                          _render("line.invoice_journal_id.code or ''")],
                'totals': [1, 0, 'text', None]},
            'partner': {
                'header': [1, 36, 'text', _render("_('Partner')")],
                'lines': [1, 0, 'text',
                          _render("line.invoice_partner_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'partner_ref': {
                'header': [1, 36, 'text', _render("_('Partner Reference')")],
                'lines':
                    [1, 0, 'text',
                     _render("line.partner_id and line.partner_id.ref or ''")
                     ],
                'totals': [1, 0, 'text', None]},
            'date': {
                'header': [1, 14, 'text', _render("_('Invoice Date')")],
                'lines':
                    [1, 0, 'date', _render(
                        "datetime.strptime(line.invoice_date,'%Y-%m-%d')"),
                     None, self.ail_cell_style_date],
                'totals': [1, 0, 'text', None]},
            'account': {
                'header': [1, 13, 'text', _render("_('Account')")],
                'lines': [1, 0, 'text', _render("line.account_id.code")],
                'totals': [1, 0, 'text', None]},
            'description': {
                'header': [1, 40, 'text', _render("_('Description')")],
                'lines': [1, 0, 'text',
                          _render("line.name and line.name or ''")],
                'totals': [1, 0, 'text', None]},
            'product': {
                'header': [1, 40, 'text', _render("_('Product')")],
                'lines': [1, 0, 'text',
                          _render("line.product_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'product_ref': {
                'header': [1, 36, 'text', _render("_('Product Reference')")],
                'lines': [1, 0, 'text',
                          _render("line.product_id.default_code or ''")],
                'totals': [1, 0, 'text', None]},
            'product_uos': {
                'header': [1, 10, 'text', _render("_('Unit of Sale')")],
                'lines': [1, 0, 'text', _render("line.uos_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'quantity': {
                'header':
                    [1, 8, 'text',
                     _render("_('Qty')"), None, self.rh_cell_style_right],
                'lines': [
                    1, 0, 'number',
                    _render("line.quantity"),
                    None, self.ail_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'price_unit': {
                'header':
                    [1, 18, 'text',
                     _render("_('Unit Price')"),
                     None, self.rh_cell_style_right],
                'lines':
                    [1, 0, 'number',
                     _render("line.price_unit"),
                     None, self.ail_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'discount': {
                'header':
                    [1, 12, 'text',
                     _render("_('Discount' + ' (%)')"),
                     None, self.rh_cell_style_right],
                'lines':
                    [1, 0, 'number',
                     _render("line.discount"),
                     None, self.ail_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'price_subtotal': {
                'header':
                    [1, 18, 'text',
                     _render("_('Subtotal')"),
                     None, self.rh_cell_style_right],
                'lines':
                    [1, 0, 'number',
                     _render("line.price_subtotal"),
                     None, self.ail_cell_style_decimal],
                'totals':
                    [1, 0, 'number',
                     None, _render("subtotal_formula"),
                     self.rt_cell_style_decimal]},
            'analytic_account': {
                'header': [1, 40, 'text', _render("_('Analytic Account')")],
                'lines':
                    [1, 0, 'text',
                     _render("line.account_analytic_id.code or ''")],
                'totals': [1, 0, 'text', None]},
            'note': {
                'header': [1, 42, 'text', _render("_('Notes')")],
                'lines': [1, 0, 'text', _render("line.note or ''")],
                'totals': [1, 0, 'text', None]},
        }
예제 #26
0
        def _prepare_col_spec_lines_template(self, invoice_type=None):
            # This is needed for translate tool to catch correctly lang handled

            user = self.pool['res.users'].browse(self.cr, self.uid, self.uid)
            context = {}
            context.update({'lang': user.lang})

            # XLS Template
            # [Cell columns span, cell width, content type, ??]
            spec_lines_template = {}
            if invoice_type == 'out_invoice':
                spec_lines_template = {
                    'number': {
                        'header': [1, 15, 'text', _render("_('N de factura')")],
                        'lines': [1, 0, 'text', _render("l['number']")],
                        'totals': [1, 0, 'text', None]},
                    'date_invoice': {
                        'header': [1, 20, 'text', _render("_('Fecha factura')")],
                        'lines': [1, 0, 'text', _render("(l['date_invoice'])")],
                        'totals': [1, 0, 'text', None]},
                    'partner_vat': {
                        'header': [1, 20, 'text', _render("_('Empresa/NIF')")],
                        'lines': [1, 0, 'text', _render("(l['partner_vat'])")],
                        'totals': [1, 0, 'text', None]},
                    'partner_name': {
                        'header': [1, 40, 'text', _render("_('Empresa/Nombre')")],
                        'lines': [1, 0, 'text', _render("l['partner_name']")],
                        'totals': [1, 0, 'text', None]},
                    'tax_base': {
                        'header': [1, 20, 'text', _render("_('Base imponible')")],
                        'lines': [1, 0, 'number', _render("l['tax_base']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'tax_amount': {
                        'header': [1, 20, 'text', _render("_('Cuota IVA')")],
                        'lines': [1, 0, 'number', _render("l['tax_amount']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'tax_percent': {
                        'header': [1, 20, 'text', _render("_('% IVA')")],
                        'lines': [1, 0, 'number', _render("l['tax_percent']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'tax_amount_rec': {
                        'header': [1, 20, 'text', _render("_('Recargo de equivalencia')")],
                        'lines': [1, 0, 'number', _render("l['tax_amount_rec']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'tax_amount_ret': {
                        'header': [1, 20, 'text', _render("_('Retenciones')")],
                        'lines': [1, 0, 'number', _render("l['tax_amount_ret']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'amount_total': {
                        'header': [1, 20, 'text', _render("_('Total')")],
                        'lines': [1, 0, 'number', _render("l['amount_total']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'country_name': {
                        'header': [1, 20, 'text', _render("_('Empresa/País/Nombre del país')")],
                        'lines': [1, 0, 'text', _render("l['country_name']")],
                        'totals': [1, 0, 'text', None]},
                    'tax_description': {
                        'header': [1, 40, 'text', _render("_('Líneas de impuestos/Descripción impuesto')")],
                        'lines': [1, 0, 'text', _render("l['tax_description']")],
                        'totals': [1, 0, 'text', None]},
                    'fiscal_name': {
                        'header': [1, 40, 'text', _render("_('Empresa/Posición fiscal/Posición fiscal')")],
                        'lines': [1, 0, 'text', _render("l['fiscal_name']")],
                        'totals': [1, 0, 'text', None]},

                }
            elif invoice_type == 'in_invoice':
                spec_lines_template = {
                    'date_invoice': {
                        'header': [1, 20, 'text', _render("_('Fecha factura')")],
                        'lines': [1, 0, 'text', _render("(l['date_invoice'])")],
                        'totals': [1, 0, 'text', None]},
                    'number': {
                        'header': [1, 15, 'text', _render("_('N de factura')")],
                        'lines': [1, 0, 'text', _render("l['number']")],
                        'totals': [1, 0, 'text', None]},
                    'supplier_number': {
                        'header': [1, 15, 'text', _render("_('N de factura del proveedor')")],
                        'lines': [1, 0, 'text', _render("l['supplier_number']")],
                        'totals': [1, 0, 'text', None]},
                    'partner_vat': {
                        'header': [1, 20, 'text', _render("_('Empresa/NIF')")],
                        'lines': [1, 0, 'text', _render("(l['partner_vat'])")],
                        'totals': [1, 0, 'text', None]},
                    'partner_name': {
                        'header': [1, 40, 'text', _render("_('Empresa/Nombre')")],
                        'lines': [1, 0, 'text', _render("l['partner_name']")],
                        'totals': [1, 0, 'text', None]},
                    'tax_base': {
                        'header': [1, 20, 'text', _render("_('Base imponible')")],
                        'lines': [1, 0, 'number', _render("l['tax_base']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'tax_description': {
                        'header': [1, 40, 'text', _render("_('Líneas de impuestos/Descripción impuesto')")],
                        'lines': [1, 0, 'text', _render("l['tax_description']")],
                        'totals': [1, 0, 'text', None]},
                    'tax_amount': {
                        'header': [1, 20, 'text', _render("_('Cuota IVA')")],
                        'lines': [1, 0, 'number', _render("l['tax_amount']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'tax_amount_ret': {
                        'header': [1, 20, 'text', _render("_('Retenciones')")],
                        'lines': [1, 0, 'number', _render("l['tax_amount_ret']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'amount_total': {
                        'header': [1, 20, 'text', _render("_('Total')")],
                        'lines': [1, 0, 'number', _render("l['amount_total']"),
                                  None, self.aml_cell_style_decimal],
                        'totals': [1, 0, 'text', None]},
                    'country_name': {
                        'header': [1, 20, 'text', _render("_('Empresa/País/Nombre del país')")],
                        'lines': [1, 0, 'text', _render("l['country_name']")],
                        'totals': [1, 0, 'text', None]},
                }

            return spec_lines_template
예제 #27
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_account_asset_xls, self).__init__(name, table, rml,
                                                       parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'text', None]
            },
            'branch_name': {
                'header': [1, 22, 'text',
                           _render("_('Branch Location')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_name']")],
                'totals': [1, 22, 'text', None]
            },
            'asset_code': {
                'header': [1, 22, 'text',
                           _render("_('Asset Code')")],
                'lines': [1, 0, 'text',
                          _render("p['asset_code']")],
                'totals': [1, 22, 'text', None]
            },
            'category_name': {
                'header': [1, 22, 'text',
                           _render("_('Asset Category')")],
                'lines': [1, 0, 'text',
                          _render("p['category_name']")],
                'totals': [1, 22, 'text', None]
            },
            'asset_account': {
                'header': [1, 22, 'text',
                           _render("_('Asset Account')")],
                'lines': [1, 0, 'text',
                          _render("p['asset_account']")],
                'totals': [1, 22, 'text', None]
            },
            'asset_name': {
                'header': [1, 22, 'text',
                           _render("_('Asset Name')")],
                'lines': [1, 0, 'text',
                          _render("p['asset_name']")],
                'totals': [1, 22, 'text', None]
            },
            'asset_owner': {
                'header': [1, 22, 'text',
                           _render("_('Asset Owner')")],
                'lines': [1, 0, 'text',
                          _render("p['asset_owner']")],
                'totals': [1, 22, 'text', None]
            },
            'purchase_date': {
                'header': [1, 22, 'text',
                           _render("_('Purchase Date')")],
                'lines': [1, 0, 'text',
                          _render("p['purchase_date']")],
                'totals': [1, 22, 'text', None]
            },
            'number_of_depr': {
                'header': [1, 22, 'text',
                           _render("_('Number of Depr')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['number_of_depr']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['number_of_depr']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'coa_depr_code': {
                'header': [1, 22, 'text',
                           _render("_('COA Depr No')")],
                'lines': [1, 0, 'text',
                          _render("p['coa_depr_code']")],
                'totals': [1, 22, 'text', None]
            },
            'coa_depr_name': {
                'header': [1, 22, 'text',
                           _render("_('COA Depr Name')")],
                'lines': [1, 0, 'text',
                          _render("p['coa_depr_name']")],
                'totals': [1, 22, 'text', None]
            },
            'status': {
                'header': [1, 22, 'text',
                           _render("_('Status')")],
                'lines': [1, 0, 'text', _render("p['status']")],
                'totals': [1, 22, 'text', None]
            },
            'purchase_value': {
                'header': [1, 22, 'text',
                           _render("_('Purchase Value')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['purchase_value']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['purchase_value']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'depr_jan': {
                'header': [1, 22, 'text', _render("_('Jan')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_jan']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_jan']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_feb': {
                'header': [1, 22, 'text', _render("_('Feb')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_feb']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_feb']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_mar': {
                'header': [1, 22, 'text', _render("_('Mar')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_mar']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_mar']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_apr': {
                'header': [1, 22, 'text', _render("_('Apr')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_apr']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_apr']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_mei': {
                'header': [1, 22, 'text', _render("_('Mei')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_mei']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_mei']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_jun': {
                'header': [1, 22, 'text', _render("_('Jun')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_jun']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_jun']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_jul': {
                'header': [1, 22, 'text', _render("_('Jul')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_jul']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_jul']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_aug': {
                'header': [1, 22, 'text', _render("_('Aug')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_aug']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_aug']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_sep': {
                'header': [1, 22, 'text', _render("_('Sep')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_sep']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_sep']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_okt': {
                'header': [1, 22, 'text', _render("_('Okt')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_okt']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_okt']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_nop': {
                'header': [1, 22, 'text', _render("_('Nop')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_nop']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_nop']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_des': {
                'header': [1, 22, 'text', _render("_('Des')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_des']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_des']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_ttloy': {
                'header': [1, 22, 'text',
                           _render("_('Total 1 Tahun')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['depr_ttloy']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['depr_ttloy']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'depreciated_value': {
                'header': [1, 22, 'text',
                           _render("_('Depreciated Value')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['purchase_value'] - p['nbv']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['purchase_value'] - p['nbv']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'nbv': {
                'header': [1, 22, 'text', _render("_('NBV')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['nbv']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['nbv']"), None, self.rt_cell_style_decimal
                ]
            },
            'depr_end_date': {
                'header':
                [1, 22, 'text',
                 _render("_('Depreciation End Date')")],
                'lines': [1, 0, 'text',
                          _render("p['depr_end_date']")],
                'totals': [1, 22, 'text', None]
            },
            'degressif_factor': {
                'header': [1, 22, 'text',
                           _render("_('Degressive Factor')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['degressif_factor']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [1, 22, 'number', None]
            },
            'analytic_combination': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Combination')"), None,
                    self.rh_cell_style_center
                ],
                'lines':
                [1, 0, 'text',
                 _render("p['analytic_combination'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_1': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Company')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_1'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_2': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Bisnis Unit')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_2'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_3': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Branch')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_3'] or ''")],
                'totals': [1, 0, 'text', None]
            },
            'analytic_4': {
                'header': [
                    1, 20, 'text',
                    _render("_('Analytic Cost Center')"), None,
                    self.rh_cell_style_center
                ],
                'lines': [1, 0, 'text',
                          _render("p['analytic_4'] or ''")],
                'totals': [1, 0, 'text', None]
            },
        }
        # XLS Template
        self.col_specs_template_details = {}
예제 #28
0
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(chart_dre_line_xls, self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(aml_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template = {
            'name': {
                'header': [1, 42, 'text', _render(u"_('Descrição')")],
                'lines': [1, 0, 'text', _render("line.name or ''")],
                'totals': [1, 0, 'text', None]},
            'code': {
                'header': [1, 42, 'text', _render(u"_('Código')")],
                'lines': [1, 0, 'text', _render("line.code or ''")],
                'totals': [1, 0, 'text', None]},
            'period': {
                'header': [1, 12, 'text', _render(u"_('Período')")],
                'lines': [1, 0, 'text', _render("line.period_id.code or line.period_id.name")],
                'totals': [1, 0, 'text', None]},
            'parent': {
                'header': [1, 12, 'text', _render(u"_('Superior')")],
                'lines': [1, 0, 'text', _render("line.parent_id.code or line.parent_id.name")],
                'totals': [1, 0, 'text', None]},
            'account': {
                'header': [1, 36, 'text', _render(u"_('Conta')")],
                'lines': [1, 0, 'text', _render("line.account_id.code or line.account_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'type': {
                'header': [1, 36, 'text', _render(u"_('Tipo')")],
                'lines': [1, 0, 'text', _render("line.type")],
                'totals': [1, 0, 'text', None]},
            'value': {
                'header': [1, 18, 'text', _render(u"_('Valor')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("line.value"), None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'sum': {
                'header': [1, 18, 'text', _render(u"_('Soma')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("line.sum"), None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
        }
예제 #29
0
    def __init__(self, name, table, rml=False,
                 parser=False, header=True, store=False):
        super(report_retur_pembelian_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(
            rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(
            pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'text', None]},  
            'branch_id': {
                'header': [1, 22, 'text', _render("_('Cabang')")],
                'lines': [1, 0, 'text', _render("p['branch_id']")],
                'totals': [1, 22, 'text', _render("_('Total')")]},
           'division': {
               'header': [1, 22, 'text', _render("_('Divisi')")],
               'lines': [1, 0, 'text', _render("p['division']")],
               'totals': [1, 22, 'text', None]},
            'number': {
                'header': [1, 22, 'text', _render("_('No Register Retur')")],
                'lines': [1, 0, 'text', _render("p['number']")],
                'totals': [1, 22, 'text', None]},
            'date': {
                'header': [1, 22, 'text', _render("_('Tgl Register Retur')")],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 22, 'text', None]},
            'invoice_retur': {
                'header': [1, 22, 'text', _render("_('Invoice Retur')")],
                'lines': [1, 0, 'text', _render("p['invoice_retur']")],
                'totals': [1, 22, 'text', None]},
            'supplier_invoice_number': {
                'header': [1, 22, 'text', _render("_('No Invoice (Supplier)')")],
                'lines': [1, 0, 'text', _render("p['supplier_invoice_number']")],
                'totals': [1, 22, 'text', None]},
            'document_date': {
                'header': [1, 22, 'text', _render("_('Tgl Invoice (Supplier)')")],
                'lines': [1, 0, 'text', _render("p['document_date']")],
                'totals': [1, 22, 'text', None]},
            'supplier': {
                'header': [1, 22, 'text', _render("_('Supplier')")],
                'lines': [1, 0, 'text', _render("p['supplier']")],
                'totals': [1, 22, 'text', None]},
            'coa': {
                'header': [1, 22, 'text', _render("_('COA')")],
                'lines': [1, 0, 'text', _render("p['coa']")],
                'totals': [1, 22, 'text', None]},
            'kode': {
                'header': [1, 22, 'text', _render("_('Kode Produk')")],
                'lines': [1, 0, 'text', _render("p['kode']")],
                'totals': [1, 22, 'text', None]},
            'deskripsi': {
                'header': [1, 22, 'text', _render("_('Deskripsi Produk')")],
                'lines': [1, 0, 'text', _render("p['deskripsi']")],
                'totals': [1, 22, 'text', None]},
            'warna': {
                'header': [1, 22, 'text', _render("_('Warna')")],
                'lines': [1, 0, 'text', _render("p['warna']")],
                'totals': [1, 22, 'text', None]},
            'engine_number': {
                'header': [1, 22, 'text', _render("_('No. Mesin')")],
                'lines': [1, 0, 'text', _render("p['engine_number']")],
                'totals': [1, 22, 'text', None]},
            'chassis_number': {
                'header': [1, 22, 'text', _render("_('No. Rangka')")],
                'lines': [1, 0, 'text', _render("p['chassis_number']")],
                'totals': [1, 22, 'text', None]},
            'price_unit': {
                'header': [1, 22, 'text', _render("_('Pembelian')")],
                'lines': [1, 0, 'number', _render("p['price_unit']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['price_unit']"), None, self.rt_cell_style_decimal]},
            'discount_amount': {
                'header': [1, 22, 'text', _render("_('Diskon')")],
                'lines': [1, 0, 'number', _render("p['discount_amount']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['discount_amount']"), None, self.rt_cell_style_decimal]},
            'price_subtotal': {
                'header': [1, 22, 'text', _render("_('Subtotal')")],
                'lines': [1, 0, 'number', _render("p['price_subtotal']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['price_subtotal']"), None, self.rt_cell_style_decimal]},
            'jumlah': {
                'header': [1, 22, 'text', _render("_('Jumlah')")],
                'lines': [1, 0, 'number', _render("p['jumlah']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['jumlah']"), None, self.rt_cell_style_decimal]},
            'product_qty': {
                'header': [1, 22, 'text', _render("_('Qty')")],
                'lines': [1, 0, 'number', _render("p['product_qty']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['product_qty']"), None, self.rt_cell_style_decimal]},
            'dpp': {
                'header': [1, 22, 'text', _render("_('DPP')")],
                'lines': [1, 0, 'number', _render("p['dpp']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['dpp']"), None, self.rt_cell_style_decimal]},
            'ppn': {
                'header': [1, 22, 'text', _render("_('PPN')")],
                'lines': [1, 0, 'number', _render("p['ppn']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['ppn']"), None, self.rt_cell_style_decimal]},
            'oos_number': {
               'header': [1, 22, 'text', _render("_('No. OOS')")],
               'lines': [1, 0, 'text', _render("p['oos_number']")],
               'totals': [1, 22, 'text', None]},
            'payment_number': {
               'header': [1, 22, 'text', _render("_('No. Payment')")],
               'lines': [1, 0, 'text', _render("p['payment_number']")],
               'totals': [1, 22, 'text', None]},
            'payment_date': {
               'header': [1, 22, 'text', _render("_('Date Payment')")],
               'lines': [1, 0, 'text', _render("p['payment_date']")],
               'totals': [1, 22, 'text', None]},
            'payment_reallocation': {
               'header': [1, 22, 'text', _render("_('Reallocation Payment')")],
               'lines': [1, 0, 'number', _render("p['payment_reallocation']"), None, self.pd_cell_style_decimal],
               'totals': [1, 22, 'text', None]},
            'saldo': {
               'header': [1, 22, 'text', _render("_('Saldo')")],
               'lines': [1, 0, 'number', _render("p['saldo']"), None, self.pd_cell_style_decimal],
               'totals': [1, 22, 'text', None]},
            'retur_type': {
               'header': [1, 22, 'text', _render("_('Tipe Retur')")],
               'lines': [1, 0, 'text', _render("p['retur_type']"), None, self.pd_cell_style_decimal],
               'totals': [1, 22, 'text', None]},
           'hutang': {
               'header': [1, 22, 'text', _render("_('Hutang')")],
               'lines': [1, 0, 'number', _render("p['hutang']"), None, self.pd_cell_style_decimal],
               'totals': [1, 22, 'text', None]},
            'nilai_persediaan': {
               'header': [1, 22, 'text', _render("_('Persediaan/HPP')")],
               'lines': [1, 0, 'number', _render("p['nilai_persediaan']"), None, self.pd_cell_style_decimal],
               'totals': [1, 22, 'text', None]},
            'invoice_beli_number': {
               'header': [1, 22, 'text', _render("_('No Nota Pembelian')")],
               'lines': [1, 0, 'text', _render("p['invoice_beli_number']")],
               'totals': [1, 22, 'text', None]},
        }
        # XLS Template
        self.col_specs_template_details = {
            
        }
    def __init__(self, name, table, rml=False, parser=False, header=False,
                 store=False):
        super(op_inquiry_modes_analysis_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill_grey'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_left = xlwt.easyxf(rh_cell_format + _xs['left'])
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(
            aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Column Spec
        self.col_specs_template = {
            'id': {
                'header': [1, 8, 'text', _render("'ID'")],
                'lines': [1, 0, 'number', _render("(line['id'] )")],
                'totals': [1, 0, 'text', None]},
            'code': {
                'header': [1, 10, 'text', _render("'CODE'")],
                'lines': [1, 0, 'text', _render("(str(line['code']) or '-')")],
                'totals': [1, 0, 'text', None]},
            'name': {
                'header': [1, 10, 'text', _render("'NAME'")],
                'lines': [1, 0, 'text', _render("(str(line['name']) or '-')")],
                'totals': [1, 0, 'text', None]},

            'sat_any': {
                'header': [1, 8, 'text', _render("'SAT'")],
                'lines': [1, 0, 'number', _render("(line['sat_any'])")],
                'totals': [1, 0, 'text', None]},
            'sun_any': {
                'header': [1, 8, 'text', _render("'SUN'")],
                'lines': [1, 0, 'number', _render("(line['sun_any'] )")],
                'totals': [1, 0, 'text', None]},
            'wkd_any': {
                'header': [1, 8, 'text', _render("'WKD'")],
                'lines': [1, 0, 'number', _render("(line['wkd_any'])")],
                'totals': [1, 0, 'text', None]},
            'sat_mor': {
                'header': [1, 8, 'text', _render("'SAT'")],
                'lines': [1, 0, 'number', _render("(line['sat_mor'])")],
                'totals': [1, 0, 'text', None]},
            'sun_mor': {
                'header': [1, 8, 'text', _render("'SUN'")],
                'lines': [1, 0, 'number', _render("(line['sun_mor'])")],
                'totals': [1, 0, 'text', None]},
            'wkd_mor': {
                'header': [1, 8, 'text', _render("'WKD'")],
                'lines': [1, 0, 'number', _render("(line['wkd_mor'])")],
                'totals': [1, 0, 'text', None]},
            'sat_aft': {
                'header': [1, 8, 'text', _render("'SAT'")],
                'lines': [1, 0, 'number', _render("(line['sat_aft'])")],
                'totals': [1, 0, 'text', None]},
            'sun_aft': {
                'header': [1, 8, 'text', _render("'SUN'")],
                'lines': [1, 0, 'number', _render("(line['sun_aft'])")],
                'totals': [1, 0, 'text', None]},
            'wkd_aft': {
                'header': [1, 8, 'text', _render("'WKD'")],
                'lines': [1, 0, 'number', _render("(line['wkd_aft'])")],
                'totals': [1, 0, 'text', None]},
            'sat_eve': {
                'header': [1, 8, 'text', _render("'SAT'")],
                'lines': [1, 0, 'number', _render("(line['sat_eve'])")],
                'totals': [1, 0, 'text', None]},
            'sun_eve': {
                'header': [1, 8, 'text', _render("'SUN'")],
                'lines': [1, 0, 'number', _render("(line['sun_eve'])")],
                'totals': [1, 0, 'text', None]},
            'wkd_eve': {
                'header': [1, 8, 'text', _render("'WKD'")],
                'lines': [1, 0, 'number', _render("(line['wkd_eve'])")],
                'totals': [1, 0, 'text', None]},
            'total': {
                'header': [1, 8, 'text', _render("'LEADS'")],
                'lines': [1, 0, 'number', _render("(line['total'])")],
                'totals': [1, 0, 'text', None]},
            'follow_ups': {
                'header': [1, 15, 'text', _render("'FOLLOW-UPS'")],
                'lines': [1, 0, 'number', _render("(line['follow_ups'])")],
                'totals': [1, 0, 'text', None]},
            'enrollments': {
                'header': [1, 15, 'text', _render("'ENROLLMENTS'")],
                'lines': [1, 0, 'number', _render("(line['enrollments'])")],
                'totals': [1, 0, 'text', None]},
        }

        self.wanted_list = ['id','code', 'name', 'sat_any', 'sun_any', 'wkd_any', 'sat_mor', 'sun_mor',
                            'wkd_mor', 'sat_aft',
                            'sun_aft', 'wkd_aft', 'sat_eve', 'sun_eve', 'wkd_eve',
                            'total', 'follow_ups', 'enrollments'
        ]
예제 #31
0
    def __init__(self, name, table, rml=False,
                 parser=False, header=True, store=False):
        super(bank_book_report_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(
            rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_center = xlwt.easyxf(ph_cell_format  + _xs['center'] )
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(
            pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.pd_cell_style_decimal_fill = xlwt.easyxf(
            pd_cell_format + _xs['right'] + _xs['fill'] + _xs['bold'] ,
            num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'number', _render("p['no']"),None,self.pd_cell_style_center],
                'totals': [1, 5, 'text', None]},                                             
            'branch_status': {
                'header': [1, 20, 'text', _render("_('Branch Status')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['branch_status'] or ''")],
                'totals': [1, 0, 'text', None]},   
            'branch_name': {
                'header': [1, 20, 'text', _render("_('Branch')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['branch_name'] or ''")],
                'totals': [1, 0, 'text', None]},   
            'account_code': {
                'header': [1, 20, 'text', _render("_('No Account')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['account_code'] or ''")],
                'totals': [1, 0, 'text', None]},  
            'account_name': {
                'header': [1, 20, 'text', _render("_('Keterangan')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['account_name'] or ''")],
                'totals': [1, 0, 'text', None]},
            'partner_name': {
                'header': [1, 20, 'text', _render("_('Partner')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['partner_name'] or ''")],
                'totals': [1, 0, 'text', None]},
            'finance_company': {
                'header': [1, 20, 'text', _render("_('Finance Company')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['finance_company'] or ''")],
                'totals': [1, 0, 'text', None]},
            'name': {
                'header': [1, 20, 'text', _render("_('Name')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['name'] or ''")],
                'totals': [1, 0, 'text', None]},
            'ref': {
                'header': [1, 20, 'text', _render("_('Ref')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['ref'] or ''")],
                'totals': [1, 0, 'text', None]},
            'date': {
                'header': [1, 15, 'text', _render("_('Tanggal')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 0, 'text', None]},            
            'value_date': {
                'header': [1, 15, 'text', _render("_('Value Date')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['value_date']")],
                'totals': [1, 0, 'text', None]},                            
            'analytic_combination': {
                'header': [1, 20, 'text', _render("_('Analytic Combination')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_combination'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_1': {
                'header': [1, 20, 'text', _render("_('Analytic Company')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_1'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_2': {
                'header': [1, 20, 'text', _render("_('Analytic Bisnis Unit')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_2'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_3': {
                'header': [1, 20, 'text', _render("_('Analytic Branch')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_3'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_4': {
                'header': [1, 20, 'text', _render("_('Analytic Cost Center')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_4'] or ''")],
                'totals': [1, 0, 'text', None]},
            'debit': {
                'header': [1, 20, 'text', _render("_('Debit')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'number', _render("p['debit'] or ''"),None,self.pd_cell_style_decimal],
                'totals': [1, 0, 'text', None]},  
            'credit': {
                'header': [1, 20, 'text', _render("_('Credit')"),None,self.rh_cell_style_center],
                'lines': [1, 20, 'number', _render("p['credit'] or ''"),None,self.pd_cell_style_decimal],
                'totals': [1, 0, 'text', None]},  
        }                                   

        # XLS Template
        self.col_specs_template_details = {
        }
예제 #32
0
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(report_penjualantax_xls, self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(
            rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(
            pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No.')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'number', None]},
            'branch_status': {
                'header': [1, 10, 'text', _render("_('Branch Status')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['branch_status'] or 'n/a'")],
                'totals': [1, 0, 'text', None]},   
            'branch_code': {
                'header': [1, 22, 'text', _render("_('Branch Code')")],
                'lines': [1, 0, 'text', _render("p['branch_code']")],
                'totals': [1, 22, 'text', _render("_('Total')")]},
            'branch_name': {
                'header': [1, 22, 'text', _render("_('Branch Name')")],
                'lines': [1, 0, 'text', _render("p['branch_name']")],
                'totals': [1, 22, 'number', None]},
            'no_registrasi': {
                'header': [1, 22, 'text', _render("_('No Registrasi')")],
                'lines': [1, 0, 'text', _render("p['no_registrasi']")],
                'totals': [1, 22, 'number', None]},
            'state_ksu': {
                'header': [1, 22, 'text', _render("_('State KSU')")],
                'lines': [1, 0, 'text', _render("p['state_ksu']")],
                'totals': [1, 22, 'number', None]},
            'state_picking': {
                'header': [1, 22, 'text', _render("_('State Picking')")],
                'lines': [1, 0, 'text', _render("p['state_picking']")],
                'totals': [1, 22, 'number', None]},
            'oos_number': {
                'header': [1, 22, 'text', _render("_('OOS Number')")],
                'lines': [1, 0, 'text', _render("p['oos_number']")],
                'totals': [1, 22, 'number', None]},
            'invoice_number': {
                'header': [1, 22, 'text', _render("_('Invoice Number')")],
                'lines': [1, 0, 'text', _render("p['invoice_number']")],
                'totals': [1, 22, 'number', None]},
            'invoice_status': {
                'header': [1, 22, 'text', _render("_('Status Invoice')")],
                'lines': [1, 0, 'text', _render("p['invoice_status']")],
                'totals': [1, 22, 'number', None]},
            'invoice_date': {
                'header': [1, 22, 'text', _render("_('Date Invoice')")],
                'lines': [1, 0, 'text', _render("p['invoice_date']")],
                'totals': [1, 22, 'number', None]},
            'tgl_lunas': {
                'header': [1, 22, 'text', _render("_('Lunas')")],
                'lines': [1, 0, 'text', _render("p['tgl_lunas']")],
                'totals': [1, 22, 'number', None]},
            'ar_days': {
                'header': [1, 22, 'text', _render("_('AR Days')")],
                'lines': [1, 0, 'text', _render("p['ar_days']")],
                'totals': [1, 22, 'number', None]},
            'md_code': {
                'header': [1, 22, 'text', _render("_('Main Dealer')")],
                'lines': [1, 0, 'text', _render("p['md_code']")],
                'totals': [1, 22, 'number', None]},
            'analytic_combination': {
                'header': [1, 20, 'text', _render("_('Analytic Combination')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_combination'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_1': {
                'header': [1, 20, 'text', _render("_('Analytic Company')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_1'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_2': {
                'header': [1, 20, 'text', _render("_('Analytic Bisnis Unit')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_2'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_3': {
                'header': [1, 20, 'text', _render("_('Analytic Branch')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_3'] or ''")],
                'totals': [1, 0, 'text', None]},
            'analytic_4': {
                'header': [1, 20, 'text', _render("_('Analytic Cost Center')"),None,self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("p['analytic_4'] or ''")],
                'totals': [1, 0, 'text', None]},
            'spk_name': {
                'header': [1, 22, 'text', _render("_('Pra SO')")],
                'lines': [1, 0, 'text', _render("p['spk_name']")],
                'totals': [1, 22, 'number', None]},
            'name': {
                'header': [1, 22, 'text', _render("_('SO Number')")],
                'lines': [1, 0, 'text', _render("p['name']")],
                'totals': [1, 22, 'number', None]},
            'state': {
                'header': [1, 22, 'text', _render("_('State')")],
                'lines': [1, 0, 'text', _render("p['state']")],
                'totals': [1, 22, 'number', None]},
            'date_order': {
                'header': [1, 22, 'text', _render("_('Date SO')")],
                'lines': [1, 0, 'text', _render("p['date_order']")],
                'totals': [1, 22, 'number', None]},
            'finco_code': {
                'header': [1, 22, 'text', _render("_('Sales Type')")],
                'lines': [1, 0, 'text', _render("p['finco_code']")],
                'totals': [1, 22, 'number', None]},
            'is_cod': {
                'header': [1, 22, 'text', _render("_('Payment Type')")],
                'lines': [1, 0, 'text', _render("p['is_cod']")],
                'totals': [1, 22, 'number', None]},
            'sales_koor_name': {
                'header': [1, 22, 'text', _render("_('Sales Coord Name')")],
                'lines': [1, 0, 'text', _render("p['sales_koor_name']")],
                'totals': [1, 22, 'number', None]},
            'sales_name': {
                'header': [1, 22, 'text', _render("_('Sales Name')")],
                'lines': [1, 0, 'text', _render("p['sales_name']")],
                'totals': [1, 22, 'number', None]},
            'job_name': {
                'header': [1, 22, 'text', _render("_('Job Name')")],
                'lines': [1, 0, 'text', _render("p['job_name']")],
                'totals': [1, 22, 'number', None]},
            'cust_code': {
                'header': [1, 22, 'text', _render("_('Customer Code')")],
                'lines': [1, 0, 'text', _render("p['cust_code']")],
                'totals': [1, 22, 'number', None]},
            'cust_name': {
                'header': [1, 22, 'text', _render("_('Customer Name')")],
                'lines': [1, 0, 'text', _render("p['cust_name']")],
                'totals': [1, 22, 'number', None]},
            'cabang_partner': {
                'header': [1, 20, 'text', _render("_('Cabang Partner')")],
                'lines': [1, 0, 'text', _render("p['cabang_partner']")],
                'totals': [1, 20, 'text', _render("p['cabang_partner']")]},
            'product_name': {
                'header': [1, 22, 'text', _render("_('Type')")],
                'lines': [1, 0, 'text', _render("p['product_name']")],
                'totals': [1, 22, 'number', None]},
            'pav_code': {
                'header': [1, 22, 'text', _render("_('Color')")],
                'lines': [1, 0, 'text', _render("p['pav_code']")],
                'totals': [1, 22, 'number', None]},
            'product_qty': {
                'header': [1, 22, 'text', _render("_('Qty')")],
                'lines': [1, 0, 'number', _render("p['product_qty']")],
                'totals': [1, 22, 'number', _render("p['product_qty']"), None, self.rt_cell_style_decimal]},
            'lot_name': {
                'header': [1, 22, 'text', _render("_('Engine Number')")],
                'lines': [1, 0, 'text', _render("p['lot_name']")],
                'totals': [1, 22, 'text', _render("p['lot_name']")]},
            'lot_chassis': {
                'header': [1, 22, 'text', _render("_('Chassis Number')")],
                'lines': [1, 0, 'text', _render("p['lot_chassis']")],
                'totals': [1, 22, 'text', _render("p['lot_chassis']")]},
            'price_unit': {
                'header': [1, 22, 'text', _render("_('Off The Road')")],
                'lines': [1, 0, 'number', _render("p['price_unit']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['price_unit']"), None, self.rt_cell_style_decimal]},
            'discount_po': {
                'header': [1, 22, 'text', _render("_('Discount Konsumen')")],
                'lines': [1, 0, 'number', _render("p['discount_po']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['discount_po']"), None, self.rt_cell_style_decimal]},
            'ps_dealer': {
                'header': [1, 22, 'text', _render("_('PS Dealer (Juklak)')")],
                'lines': [1, 0, 'number', _render("p['ps_dealer']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['ps_dealer']"), None, self.rt_cell_style_decimal]},
            'ps_ahm': {
                'header': [1, 22, 'text', _render("_('PS AHM (Juklak)')")],
                'lines': [1, 0, 'number', _render("p['ps_ahm']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['ps_ahm']"), None, self.rt_cell_style_decimal]},
            'ps_md': {
                'header': [1, 22, 'text', _render("_('PS MD (Juklak)')")],
                'lines': [1, 0, 'number', _render("p['ps_md']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['ps_md']"), None, self.rt_cell_style_decimal]},
            'ps_finco': {
                'header': [1, 22, 'text', _render("_('PS Finco (Juklak)')")],
                'lines': [1, 0, 'number', _render("p['ps_finco']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['ps_finco']"), None, self.rt_cell_style_decimal]},
            'ps_total': {
                'header': [1, 22, 'text', _render("_('PS Total')")],
                'lines': [1, 0, 'number', _render("p['ps_total']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['ps_total']"), None, self.rt_cell_style_decimal]},
            'sales': {
                'header': [1, 22, 'text', _render("_('Nett Sales')")],
                'lines': [1, 0, 'number', _render("p['sales']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['sales']"), None, self.rt_cell_style_decimal]},
            'disc_reg': {
                'header': [1, 22, 'text', _render("_('Total Disc Reg (Nett)')")],
                'lines': [1, 0, 'number', _render("p['disc_reg']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['disc_reg']"), None, self.rt_cell_style_decimal]},
            'disc_quo': {
                'header': [1, 22, 'text', _render("_('Total Disc PS (Nett)')")],
                'lines': [1, 0, 'number', _render("p['disc_quo']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['disc_quo']"), None, self.rt_cell_style_decimal]},
            'disc_quo_incl_tax': {
                'header': [1, 22, 'text', _render("_('Total Disc PS (Incl Tax)')")],
                'lines': [1, 0, 'number', _render("p['disc_quo_incl_tax']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['disc_quo_incl_tax']"), None, self.rt_cell_style_decimal]},
            'disc_total': {
                'header': [1, 22, 'text', _render("_('Total Disc')")],
                'lines': [1, 0, 'number', _render("p['disc_total']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['disc_total']"), None, self.rt_cell_style_decimal]},
            'price_subtotal': {
                'header': [1, 22, 'text', _render("_('DPP')")],
                'lines': [1, 0, 'number', _render("p['price_subtotal']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['price_subtotal']"), None, self.rt_cell_style_decimal]},
            'PPN': {
                'header': [1, 22, 'text', _render("_('PPN')")],
                'lines': [1, 0, 'number', _render("p['PPN']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['PPN']"), None, self.rt_cell_style_decimal]},
            'total': {
                'header': [1, 22, 'text', _render("_('Total')")],
                'lines': [1, 0, 'number', _render("p['total']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['total']"), None, self.rt_cell_style_decimal]},
            'force_cogs': {
                'header': [1, 22, 'text', _render("_('HPP')")],
                'lines': [1, 0, 'number', _render("p['force_cogs']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['force_cogs']"), None, self.rt_cell_style_decimal]},
            'piutang_dp': {
                'header': [1, 22, 'text', _render("_('Piutang JP Nett')")],
                'lines': [1, 0, 'number', _render("p['piutang_dp']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['piutang_dp']"), None, self.rt_cell_style_decimal]},
            'piutang': {
                'header': [1, 22, 'text', _render("_('Piutang')")],
                'lines': [1, 0, 'number', _render("p['piutang']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['piutang']"), None, self.rt_cell_style_decimal]},
            'piutang_total': {
                'header': [1, 22, 'text', _render("_('Piutang Total')")],
                'lines': [1, 0, 'number', _render("p['piutang_total']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['piutang_total']"), None, self.rt_cell_style_decimal]},
            'gp_dpp_minus_hpp': {
                'header': [1, 22, 'text', _render("_('GP (DPP - HPP)')")],
                'lines': [1, 0, 'number', _render("p['gp_dpp_minus_hpp']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['gp_dpp_minus_hpp']"), None, self.rt_cell_style_decimal]},
            'gp_unit': {
                'header': [1, 22, 'text', _render("_('GP + Klaim')")],
                'lines': [1, 0, 'number', _render("p['gp_unit']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['gp_unit']"), None, self.rt_cell_style_decimal]},
            'amount_hutang_komisi': {
                'header': [1, 22, 'text', _render("_('Hutang Komisi')")],
                'lines': [1, 0, 'number', _render("p['amount_hutang_komisi']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['amount_hutang_komisi']"), None, self.rt_cell_style_decimal]},
            'dpp_insentif_finco': {
                'header': [1, 22, 'text', _render("_('DPP Insentif Finco')")],
                'lines': [1, 0, 'number', _render("p['dpp_insentif_finco']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['dpp_insentif_finco']"), None, self.rt_cell_style_decimal]},
            'price_bbn': {
                'header': [1, 22, 'text', _render("_('Sales BBN')")],
                'lines': [1, 0, 'number', _render("p['price_bbn']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['price_bbn']"), None, self.rt_cell_style_decimal]},
            'price_bbn_beli': {
                'header': [1, 22, 'text', _render("_('HPP BBN')")],
                'lines': [1, 0, 'number', _render("p['price_bbn_beli']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['price_bbn_beli']"), None, self.rt_cell_style_decimal]},
            'gp_bbn': {
                'header': [1, 22, 'text', _render("_('GP BBN')")],
                'lines': [1, 0, 'number', _render("p['gp_bbn']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['gp_bbn']"), None, self.rt_cell_style_decimal]},
            'gp_total': {
                'header': [1, 22, 'text', _render("_('Total GP')")],
                'lines': [1, 0, 'number', _render("p['gp_total']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['gp_total']"), None, self.rt_cell_style_decimal]},
            'beban_cabang': {
                'header': [1, 22, 'text', _render("_('Beban Cabang')")],
                'lines': [1, 0, 'number', _render("p['beban_cabang']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['beban_cabang']"), None, self.rt_cell_style_decimal]},
            'categ_name': {
                'header': [1, 22, 'text', _render("_('Category Name')")],
                'lines': [1, 0, 'text', _render("p['categ_name']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'text', _render("p['categ_name']")]},
            'categ2_name': {
                'header': [1, 22, 'text', _render("_('Parent Category Name')")],
                'lines': [1, 0, 'text', _render("p['categ2_name']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'text', _render("p['categ2_name']")]},
            'prod_series': {
                'header': [1, 22, 'text', _render("_('Series')")],
                'lines': [1, 0, 'text', _render("p['prod_series']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'text', _render("p['prod_series']")]},
            'faktur_pajak': {
                'header': [1, 22, 'text', _render("_('Faktur Pajak')")],
                'lines': [1, 0, 'text', _render("p['faktur_pajak']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'text', _render("p['faktur_pajak']")]},
            'partner_komisi_id': {
                'header': [1, 22, 'text', _render("_('Partner Komisi')")],
                'lines': [1, 0, 'text', _render("p['partner_komisi_id']")],
                'totals': [1, 22, 'number', None]},
            'proposal_id': {
                'header': [1, 22, 'text', _render("_('Proposal Event')")],
                'lines': [1, 0, 'text', _render("p['proposal_id']")],
                'totals': [1, 22, 'number', None]},
            'hutang_komisi_id': {
                'header': [1, 22, 'text', _render("_('Hutang Komisi')")],
                'lines': [1, 0, 'text', _render("p['hutang_komisi_id']")],
                'totals': [1, 22, 'number', None]},
            'or_name': {
                'header': [1, 22, 'text', _render("_('Other Receivables')")],
                'lines': [1, 0, 'text', _render("p['or_name']")],
                'totals': [1, 22, 'number', None]},
            # 'or_amount': {
            #     'header': [1, 22, 'text', _render("_('Other Receivables Amount')")],
            #     'lines': [1, 0, 'number', _render("p['or_amount']"), None, self.pd_cell_style_decimal],
            #     'totals': [1, 22, 'number', _render("p['or_amount']"), None, self.rt_cell_style_decimal]},
            'pph_komisi': {
                'header': [1, 22, 'text', _render("_('PPH Komisi')")],
                'lines': [1, 0, 'number', _render("p['pph_komisi']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'number', _render("p['pph_komisi']"), None, self.rt_cell_style_decimal]},
            'pkp': {
                'header': [1, 22, 'text', _render("_('PKP / Non PKP')")],
                'lines': [1, 0, 'text', _render("p['pkp']"), None, self.pd_cell_style_decimal],
                'totals': [1, 22, 'text', _render("p['pkp']")]},


        }
예제 #33
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_penerimaan_unit_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'text', None]
            },
            'branch_id': {
                'header': [1, 22, 'text',
                           _render("_('Cabang')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_id']")],
                'totals': [1, 22, 'text', _render("_('Total')")]
            },
            'supplier': {
                'header': [1, 22, 'text',
                           _render("_('Supplier')")],
                'lines': [1, 0, 'text', _render("p['supplier']")],
                'totals': [1, 22, 'text', None]
            },
            'date': {
                'header': [1, 22, 'text',
                           _render("_('BPB Date')")],
                'lines': [1, 0, 'text', _render("p['date']")],
                'totals': [1, 22, 'text', None]
            },
            'number': {
                'header': [1, 22, 'text',
                           _render("_('BPB No')")],
                'lines': [1, 0, 'text', _render("p['number']")],
                'totals': [1, 22, 'text', None]
            },
            'surat_jalan': {
                'header': [1, 22, 'text',
                           _render("_('SJ SUPPLIER No.')")],
                'lines': [1, 0, 'text',
                          _render("p['surat_jalan']")],
                'totals': [1, 22, 'text', None]
            },
            'supplier_invoice_number': {
                'header': [1, 22, 'text',
                           _render("_('Faktur')")],
                'lines':
                [1, 0, 'text',
                 _render("p['supplier_invoice_number']")],
                'totals': [1, 22, 'text', None]
            },
            'document_date': {
                'header': [1, 22, 'text',
                           _render("_('Faktur Date')")],
                'lines': [1, 0, 'text',
                          _render("p['document_date']")],
                'totals': [1, 22, 'text', None]
            },
            'product_code': {
                'header': [1, 22, 'text', _render("_('VType')")],
                'lines': [1, 0, 'text',
                          _render("p['product_code']")],
                'totals': [1, 22, 'text', None]
            },
            'posisi': {
                'header': [1, 22, 'text',
                           _render("_('Status.')")],
                'lines': [1, 0, 'text', _render("p['posisi']")],
                'totals': [1, 22, 'text', None]
            },
            'mesin': {
                'header': [1, 22, 'text',
                           _render("_('No. Mesin')")],
                'lines': [1, 0, 'text', _render("p['mesin']")],
                'totals': [1, 22, 'text', None]
            },
            'rangka': {
                'header': [1, 22, 'text',
                           _render("_('No. Rangka')")],
                'lines': [1, 0, 'text', _render("p['rangka']")],
                'totals': [1, 22, 'text', None]
            },
            'price_unit': {
                'header': [1, 22, 'text',
                           _render("_('Harga/Unit')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['price_unit']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['price_unit']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'discount': {
                'header': [1, 22, 'text',
                           _render("_('Discount')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['discount']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['discount']"), None, self.rt_cell_style_decimal
                ]
            },
            'ap_unit': {
                'header': [1, 22, 'text', _render("_('DPP')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['ap_unit']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['ap_unit']"), None, self.rt_cell_style_decimal
                ]
            },
        }
        # XLS Template
        self.col_specs_template_details = {}
 def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
     super(report_smove_xls, self).__init__(name, table, rml, parser, header, store)
     
     # Cell Styles
     _xs = self.xls_styles
     
     header_total_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
     
     # Format Nomor
     self.number_style = xlwt.easyxf(_xs['center'])
     
     # Format Kolom Header
     self.column_header_style = xlwt.easyxf(header_total_format)
     
     # Format Kolom Data
     column_data_format = _xs['borders_all']
     self.column_data_style = xlwt.easyxf(column_data_format)
     self.column_data_style_date = xlwt.easyxf(column_data_format + _xs['left'], num_format_str=report_xls.date_format)
     self.column_data_style_decimal = xlwt.easyxf(column_data_format + _xs['right'], num_format_str=report_xls.decimal_format)
     
     # Format Total
     self.total_style = xlwt.easyxf(header_total_format)
     self.total_style_decimal = xlwt.easyxf(header_total_format + _xs['right'], num_format_str=report_xls.decimal_format)
     
     # XLS Template
     self.col_specs_template_overview = {
         'no': {
             'header': [1, 5, 'text', _render("_('No')")],
             'lines': [1, 0, 'number', _render("p['no']"), None, self.number_style],
             'totals': [1, 5, 'number', None]},
         'picking_type_name': {
             'header': [1, 25, 'text', _render("_('Picking Type')")],
             'lines': [1, 0, 'text', _render("p['picking_type_name']")],
             'totals': [1, 25, 'number', None]},
         'picking_name': {
             'header': [1, 25, 'text', _render("_('Picking Number')")],
             'lines': [1, 0, 'text', _render("p['picking_name']")],
             'totals': [1, 25, 'number', None]},
         'partner_name': {
             'header': [1, 30, 'text', _render("_('Partner Name')")],
             'lines': [1, 0, 'text', _render("p['partner_name']")],
             'totals': [1, 30, 'number', None]},
         'prod_tmpl': {
             'header': [1, 30, 'text', _render("_('Product')")],
             'lines': [1, 0, 'text', _render("p['prod_tmpl']")],
             'totals': [1, 30, 'number', None]},
         'qty': {
             'header': [1, 15, 'text', _render("_('Quantity')")],
             'lines': [1, 0, 'number', _render("p['qty']"), None, self.column_data_style_decimal],
             'totals': [1, 15, 'number', None]},
         'pick_date': {
             'header': [1, 25, 'text', _render("_('Date')")],
             'lines': [1, 0, 'text', _render("p['pick_date']")],
             'totals': [1, 25, 'number', None]},
         'pick_date_done': {
             'header': [1, 25, 'text', _render("_('Date of Transfer')")],
             'lines': [1, 0, 'text', _render("p['pick_date_done']")],
             'totals': [1, 25, 'number', None]},
         'src_location': {
             'header': [1, 35, 'text', _render("_('Source Location')")],
             'lines': [1, 0, 'text', _render("p['src_location']")],
             'totals': [1, 35, 'number', None]},
         'dest_location': {
             'header': [1, 35, 'text', _render("_('Destination Location')")],
             'lines': [1, 0, 'text', _render("p['dest_location']")],
             'totals': [1, 35, 'number', None]},
         'origin': {
             'header': [1, 25, 'text', _render("_('Source Document')")],
             'lines': [1, 0, 'text', _render("p['origin']")],
             'totals': [1, 25, 'number', None]},
         'backorder': {
             'header': [1, 25, 'text', _render("_('Backorder')")],
             'lines': [1, 0, 'text', _render("p['backorder']")],
             'totals': [1, 25, 'number', None]},
     }
    def __init__(self, name, table, rml=False,
                 parser=False, header=True, store=False):
        super(partner_open_arap_xls, self).__init__(
            name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(
            rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + fill_blue + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(
            pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template - overview
        self.col_specs_template_overview = {
            'partner': {
                'header': [1, 44, 'text', _render("_('Partner')")],
                'lines': [1, 0, 'text', _render("p['p_name'] or 'n/a'")],
                'totals': [1, 0, 'text', None]},
            'partner_ref': {
                'header': [1, 22, 'text', _render("_('Partner Reference')")],
                'lines': [1, 0, 'text', _render("p['p_ref'] or 'n/a'")],
                'totals': [1, 0, 'text', None]},
            'debit': {
                'header': [
                    1, 14, 'text',
                    _render("_('Debit')"), None, self.rh_cell_style_right],
                'lines': [
                    1, 0, 'number',
                    _render("p['d']"), None, self.pd_cell_style_decimal],
                'totals': [
                    1, 0, 'number', None,
                    _render("debit_formula"), self.rt_cell_style_decimal]},
            'credit': {
                'header': [
                    1, 14, 'text',
                    _render("_('Credit')"), None, self.rh_cell_style_right],
                'lines': [
                    1, 0, 'number',
                    _render("p['c']"), None, self.pd_cell_style_decimal],
                'totals': [
                    1, 0, 'number', None,
                    _render("credit_formula"), self.rt_cell_style_decimal]},
            'balance': {
                'header': [
                    1, 14, 'text',
                    _render("_('Balance')"), None, self.rh_cell_style_right],
                'lines': [
                    1, 0, 'number', None,
                    _render("bal_formula_o"), self.pd_cell_style_decimal],
                'totals': [
                    1, 0, 'number', None,
                    _render("bal_formula"), self.rt_cell_style_decimal]},
        }

        # XLS Template - details - common
        self.col_specs_template_details = {
            'document': {
                'header1': [1, 20, 'text', _render("_('Document')")],
                'header2': [1, 0, 'text', _render("p['p_name'] or 'n/a'")],
                'lines': [1, 0, 'text', _render("l['docname']")],
                'totals1': [1, 0, 'text', None],
                'totals2': [1, 0, 'text', None]},
            'sup_inv_nr': {
                'header1':
                    [1, 20, 'text', _render("_('Supplier Invoice No')")],
                'header2': [1, 0, 'text', None],
                'lines': [1, 0, 'text', _render("l['sup_inv_nr'] or ''")],
                'totals1': [1, 0, 'text', None],
                'totals2': [1, 0, 'text', None]},
            'date': {
                'header1': [1, 12, 'text', _render("_('Date')")],
                'header2': [1, 0, 'text', None],
                'lines': [
                    1, 0, 'date',
                    _render("datetime.strptime(l['l_date'],'%Y-%m-%d')"),
                    None, self.pd_cell_style_date],
                'totals1': [1, 0, 'text', None],
                'totals2': [1, 0, 'text', None]},
            'date_maturity': {
                'header1': [1, 12, 'text', _render("_('Due Date')")],
                'header2': [1, 0, 'text', None],
                'lines': [
                    1, 0, _render("l['date_due'] and 'date' or 'text'"),
                    _render("l['date_due'] and "
                            "datetime.strptime(l['date_due'],'%Y-%m-%d') "
                            "or None"),
                    None, self.pd_cell_style_date],
                'totals1': [1, 0, 'text', None],
                'totals2': [1, 0, 'text', None]},
            'account': {
                'header1': [1, 20, 'text', _render("_('Account')")],
                'header2': [1, 0, 'text', None],
                'lines': [1, 0, 'text', _render("l['a_code']")],
                'totals1': [1, 0, 'text', None],
                'totals2': [1, 0, 'text', None]},
            'description': {
                'header1': [1, 65, 'text', _render("_('Description')")],
                'header2': [1, 42, 'text', _render("p['p_ref'] or 'n/a'")],
                'lines': [1, 0, 'text', _render("l['l_name']")],
                'totals1': [1, 0, 'text', None],
                'totals2': [1, 0, 'text', None]},
            'rec_or_rec_part': {
                'header1': [1, 14, 'text', _render("_('Rec')")],
                'header2': [1, 12, 'text', None],
                'lines': [
                    1, 0, 'text',
                    _render("l['r_name'] or l['rp_name']"), None,
                    self.pd_cell_style_center],
                'totals1': [1, 0, 'text', None],
                'totals2': [
                    1, 14, 'text',
                    _render("_('Totals')"), None,
                    self.rt_cell_style_right]},
            'debit': {
                'header1': [
                    1, 14, 'text',
                    _render("_('Debit')"), None,
                    self.rh_cell_style_right],
                'header2': [
                    1, 0, 'number', None,
                    _render("debit_formula"),
                    self.ph_cell_style_decimal],
                'lines': [
                    1, 0, 'number',
                    _render("l['debit']"), None,
                    self.pd_cell_style_decimal],
                'totals1': [1, 0, 'text', _render("_('Debit')")],
                'totals2': [
                    1, 0, 'number', None,
                    _render("debit_formula"),
                    self.rt_cell_style_decimal]},
            'credit': {
                'header1': [
                    1, 14, 'text',
                    _render("_('Credit')"), None,
                    self.rh_cell_style_right],
                'header2': [
                    1, 0, 'number', None,
                    _render("credit_formula"),
                    self.ph_cell_style_decimal],
                'lines': [
                    1, 0, 'number',
                    _render("l['credit']"), None,
                    self.pd_cell_style_decimal],
                'totals1': [1, 0, 'text', _render("_('Credit')")],
                'totals2': [
                    1, 0, 'number', None,
                    _render("credit_formula"),
                    self.rt_cell_style_decimal]},
            'balance': {
                'header1': [
                    1, 14, 'text',
                    _render("_('Balance')"), None,
                    self.rh_cell_style_right],
                'header2': [
                    1, 18, 'number', None,
                    _render("bal_formula_d"),
                    self.ph_cell_style_decimal],
                'lines': [
                    1, 0, 'number', None,
                    _render("bal_formula"),
                    self.pd_cell_style_decimal],
                'totals1': [1, 0, 'text', _render("_('Balance')")],
                'totals2': [
                    1, 0, 'number', None,
                    _render("bal_formula"),
                    self.rt_cell_style_decimal]},
        }
예제 #36
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_stock_movement_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'text', None]
            },
            'branch_code': {
                'header': [1, 22, 'text',
                           _render("_('Kode Cabang')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_code']")],
                'totals': [1, 22, 'text', _render("_('Total')")]
            },
            'branch_name': {
                'header': [1, 22, 'text',
                           _render("_('Nama Cabang')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_name']")],
                'totals': [1, 22, 'text', None]
            },
            'division': {
                'header': [1, 22, 'text',
                           _render("_('Division')")],
                'lines': [1, 0, 'text', _render("p['division']")],
                'totals': [1, 22, 'text', None]
            },
            'picking_type_name': {
                'header': [1, 22, 'text',
                           _render("_('Movement Type')")],
                'lines': [1, 0, 'text',
                          _render("p['picking_type_name']")],
                'totals': [1, 22, 'text', None]
            },
            'packing_name': {
                'header': [1, 22, 'text',
                           _render("_('Movement Number')")],
                'lines': [1, 0, 'text',
                          _render("p['packing_name']")],
                'totals': [1, 22, 'text', None]
            },
            'packing_state': {
                'header': [1, 22, 'text',
                           _render("_('Movement State')")],
                'lines': [1, 0, 'text',
                          _render("p['packing_state']")],
                'totals': [1, 22, 'text', None]
            },
            'packing_date': {
                'header': [1, 22, 'text',
                           _render("_('Movement Date')")],
                'lines': [1, 0, 'text',
                          _render("p['packing_date']")],
                'totals': [1, 22, 'text', None]
            },
            'partner_code': {
                'header': [1, 22, 'text',
                           _render("_('Partner Code')")],
                'lines': [1, 0, 'text',
                          _render("p['partner_code']")],
                'totals': [1, 22, 'text', None]
            },
            'partner_name': {
                'header': [1, 44, 'text',
                           _render("_('Partner Name')")],
                'lines': [1, 0, 'text',
                          _render("p['partner_name']")],
                'totals': [1, 44, 'text', None]
            },
            'ekspedisi_code': {
                'header': [1, 22, 'text',
                           _render("_('Expedition Code')")],
                'lines': [1, 0, 'text',
                          _render("p['ekspedisi_code']")],
                'totals': [1, 22, 'text', None]
            },
            'ekspedisi_name': {
                'header': [1, 44, 'text',
                           _render("_('Expedition Name')")],
                'lines': [1, 0, 'text',
                          _render("p['ekspedisi_name']")],
                'totals': [1, 44, 'text', None]
            },
            'prod_tmpl': {
                'header': [1, 22, 'text', _render("_('Type')")],
                'lines': [1, 0, 'text',
                          _render("p['prod_tmpl']")],
                'totals': [1, 22, 'text', None]
            },
            'color': {
                'header': [1, 22, 'text', _render("_('Warna')")],
                'lines': [1, 0, 'text', _render("p['color']")],
                'totals': [1, 22, 'text', None]
            },
            'engine': {
                'header': [1, 22, 'text',
                           _render("_('Engine number')")],
                'lines': [1, 0, 'text', _render("p['engine']")],
                'totals': [1, 22, 'text', None]
            },
            'chassis': {
                'header': [1, 22, 'text',
                           _render("_('Chassis Number')")],
                'lines': [1, 0, 'text', _render("p['chassis']")],
                'totals': [1, 22, 'text', None]
            },
            'qty': {
                'header': [1, 22, 'text', _render("_('Qty')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['qty']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 22, 'number',
                    _render("p['qty']"), None, self.rt_cell_style_decimal
                ]
            },
            'location': {
                'header':
                [1, 22, 'text',
                 _render("_('Location Tujuan (Child)')")],
                'lines': [1, 0, 'text', _render("p['location']")],
                'totals': [1, 22, 'text', None]
            },
            'parent_location': {
                'header':
                [1, 22, 'text',
                 _render("_('Location Tujuan (Parent)')")],
                'lines': [1, 0, 'text',
                          _render("p['parent_location']")],
                'totals': [1, 22, 'text', None]
            },
            'location_source': {
                'header':
                [1, 22, 'text',
                 _render("_('Location Asal (Child)')")],
                'lines': [1, 0, 'text',
                          _render("p['location_source']")],
                'totals': [1, 22, 'text', None]
            },
            'parent_location_source': {
                'header':
                [1, 22, 'text',
                 _render("_('Location Asal (Parent)')")],
                'lines':
                [1, 0, 'text',
                 _render("p['parent_location_source']")],
                'totals': [1, 22, 'text', None]
            },
            'status_rfs': {
                'header': [1, 22, 'text',
                           _render("_('Status (RFS/NRFS)')")],
                'lines': [1, 0, 'text',
                          _render("p['status_rfs']")],
                'totals': [1, 22, 'text', None]
            },
            'tahun': {
                'header': [1, 22, 'text',
                           _render("_('Tahun Rakit')")],
                'lines': [1, 0, 'text', _render("p['tahun']")],
                'totals': [1, 22, 'text', None]
            },
            'picking_origin': {
                'header': [1, 22, 'text',
                           _render("_('Source Document')")],
                'lines': [1, 0, 'text',
                          _render("p['picking_origin']")],
                'totals': [1, 22, 'text', None]
            },
            'backorder': {
                'header': [1, 22, 'text',
                           _render("_('Backorder')")],
                'lines': [1, 0, 'text',
                          _render("p['backorder']")],
                'totals': [1, 22, 'text', None]
            },
            'categ_name': {
                'header': [1, 22, 'text',
                           _render("_('Kategori')")],
                'lines': [1, 0, 'text',
                          _render("p['categ_name']")],
                'totals': [1, 22, 'text', None]
            },
            'internal_ref': {
                'header': [1, 22, 'text',
                           _render("_('Deskripsi')")],
                'lines': [1, 0, 'text',
                          _render("p['internal_ref']")],
                'totals': [1, 22, 'text', None]
            },
            'branch_source': {
                'header': [1, 22, 'text',
                           _render("_('Source Branch')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_source']")],
                'totals': [1, 22, 'text', None]
            },
        }
예제 #37
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(account_journal_xls, self).__init__(name, table, rml, parser,
                                                  header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format +
                                                 _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template Journal Items
        self.col_specs_lines_template = {
            'move_name': {
                'header': [1, 20, 'text', _render("_('Entry')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id']))"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'move_date': {
                'header': [1, 13, 'text', _render("_('Date')")],
                'lines': [
                    1, 0, 'date',
                    _render("datetime.strptime(l['move_date'],'%Y-%m-%d')"),
                    None, self.aml_cell_style_date
                ],
                'totals': [1, 0, 'text', None]
            },
            'acc_code': {
                'header': [1, 12, 'text',
                           _render("_('Account')")],
                'lines': [1, 0, 'text', _render("l['acc_code']")],
                'totals': [1, 0, 'text', None]
            },
            'aml_name': {
                'header': [1, 42, 'text',
                           _render("_('Description')")],
                'lines': [1, 0, 'text', _render("l['aml_name']")],
                'totals': [1, 0, 'text', None]
            },
            'period': {
                'header': [1, 12, 'text',
                           _render("_('Period')")],
                'lines': [1, 0, 'text', _render("l['period']")],
                'totals': [1, 0, 'text', None]
            },
            'partner_name': {
                'header': [1, 36, 'text',
                           _render("_('Partner')")],
                'lines': [1, 0, 'text',
                          _render("l['partner_name']")],
                'totals': [1, 0, 'text', None]
            },
            'partner_ref': {
                'header': [1, 36, 'text',
                           _render("_('Partner Reference')")],
                'lines': [1, 0, 'text',
                          _render("l['partner_ref']")],
                'totals': [1, 0, 'text', None]
            },
            'date_maturity': {
                'header': [1, 13, 'text',
                           _render("_('Maturity Date')")],
                'lines': [
                    1, 0,
                    _render("l['date_maturity'] and 'date' or 'text'"),
                    _render(
                        "l['date_maturity'] and datetime.strptime(l['date_maturity'],'%Y-%m-%d') or None"
                    ), None, self.aml_cell_style_date
                ],
                'totals': [1, 0, 'text', None]
            },
            'debit': {
                'header': [
                    1, 18, 'text',
                    _render("_('Debit')"), None, self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number',
                    _render("l['debit']"), None, self.aml_cell_style_decimal
                ],
                'totals': [
                    1, 0, 'number', None,
                    _render("debit_formula"), self.rt_cell_style_decimal
                ]
            },
            'credit': {
                'header': [
                    1, 18, 'text',
                    _render("_('Credit')"), None, self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number',
                    _render("l['credit']"), None, self.aml_cell_style_decimal
                ],
                'totals': [
                    1, 0, 'number', None,
                    _render("credit_formula"), self.rt_cell_style_decimal
                ]
            },
            'balance': {
                'header': [
                    1, 18, 'text',
                    _render("_('Balance')"), None, self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number', None,
                    _render("bal_formula"), self.aml_cell_style_decimal
                ],
                'totals': [
                    1, 0, 'number', None,
                    _render("bal_formula"), self.rt_cell_style_decimal
                ]
            },
            'reconcile': {
                'header': [
                    1, 12, 'text',
                    _render("_('Rec.')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'text',
                    _render("l['reconcile']"), None, self.aml_cell_style_center
                ],
                'totals': [1, 0, 'text', None]
            },
            'reconcile_partial': {
                'header': [
                    1, 12, 'text',
                    _render("_('Part. Rec.')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'text',
                    _render("l['reconcile_partial']"), None,
                    self.aml_cell_style_center
                ],
                'totals': [1, 0, 'text', None]
            },
            'tax_code': {
                'header': [
                    1, 6, 'text',
                    _render("_('VAT')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'text',
                    _render("l['tax_code']"), None, self.aml_cell_style_center
                ],
                'totals': [1, 0, 'text', None]
            },
            'tax_amount': {
                'header': [
                    1, 18, 'text',
                    _render("_('VAT Amount')"), None, self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number',
                    _render("l['tax_amount']"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'amount_currency': {
                'header': [
                    1, 18, 'text',
                    _render("_('Am. Currency')"), None,
                    self.rh_cell_style_right
                ],
                'lines': [
                    1, 0,
                    _render("l['amount_currency'] and 'number' or 'text'"),
                    _render("l['amount_currency'] or None"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'currency_name': {
                'header': [
                    1, 6, 'text',
                    _render("_('Curr.')"), None, self.rh_cell_style_center
                ],
                'lines': [
                    1, 0, 'text',
                    _render("l['currency_name']"), None,
                    self.aml_cell_style_center
                ],
                'totals': [1, 0, 'text', None]
            },
            'docname': {
                'header': [1, 35, 'text',
                           _render("_('Document')")],
                'lines': [1, 0, 'text', _render("l['docname']")],
                'totals': [1, 0, 'text', None]
            },
            'move_ref': {
                'header': [1, 25, 'text',
                           _render("_('Entry Reference')")],
                'lines': [1, 0, 'text', _render("l['move_ref']")],
                'totals': [1, 0, 'text', None]
            },
            'move_id': {
                'header': [1, 10, 'text',
                           _render("_('Entry Id')")],
                'lines': [1, 0, 'text',
                          _render("str(l['move_id'])")],
                'totals': [1, 0, 'text', None]
            },
        }

        # XLS Template VAT Summary
        self.col_specs_vat_summary_template = {
            'tax_case_name': {
                'header': [1, 45, 'text',
                           _render("_('Description')")],
                'tax_totals': [1, 0, 'text', _render("t.name")]
            },
            'tax_code': {
                'header': [1, 6, 'text', _render("_('Case')")],
                'tax_totals': [1, 0, 'text', _render("t.code")]
            },
            'tax_amount': {
                'header': [
                    1, 18, 'text',
                    _render("_('Amount')"), None, self.rh_cell_style_right
                ],
                'tax_totals': [
                    1, 0, 'number',
                    _render("sum_vat(o,t)"), None, self.aml_cell_style_decimal
                ]
            },
        }
예제 #38
0
파일: report_xls.py 프로젝트: kit9/dym
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_proposal_event_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'text', _render("p['no']")],
                'totals': [1, 5, 'text', None]
            },
            'branch_id': {
                'header': [1, 22, 'text',
                           _render("_('Cabang')")],
                'lines': [1, 0, 'text',
                          _render("p['branch_id']")],
                'totals': [1, 22, 'text', None]
            },
            'division': {
                'header': [1, 22, 'text',
                           _render("_('Divisi')")],
                'lines': [1, 0, 'text', _render("p['division']")],
                'totals': [1, 22, 'text', None]
            },
            'activity': {
                'header': [1, 22, 'text',
                           _render("_('Activity')")],
                'lines': [1, 0, 'text', _render("p['activity']")],
                'totals': [1, 22, 'text', None]
            },
            'address': {
                'header': [1, 22, 'text',
                           _render("_('Activity Address')")],
                'lines': [1, 0, 'text', _render("p['address']")],
                'totals': [1, 22, 'text', None]
            },
            'start_date': {
                'header': [1, 22, 'text',
                           _render("_('Start Date')")],
                'lines': [1, 0, 'text',
                          _render("p['start_date']")],
                'totals': [1, 22, 'text', None]
            },
            'end_date': {
                'header': [1, 22, 'text',
                           _render("_('End Date')")],
                'lines': [1, 0, 'text', _render("p['end_date']")],
                'totals': [1, 22, 'text', None]
            },
            'pic': {
                'header': [1, 22, 'text', _render("_('PIC')")],
                'lines': [1, 0, 'text', _render("p['pic']")],
                'totals': [1, 22, 'text', None]
            },
            'desc_opex': {
                'header': [1, 22, 'text',
                           _render("_('Desc. OPEX')")],
                'lines': [1, 0, 'text',
                          _render("p['desc_opex']")],
                'totals': [1, 22, 'text', None]
            },
            'bud_opex': {
                'header': [1, 22, 'text',
                           _render("_('Budget OPEX')")],
                'lines': [1, 0, 'number',
                          _render("p['bud_opex']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['bud_opex']"), None, self.rt_cell_style_decimal
                ]
            },
            'act_opex': {
                'header': [1, 22, 'text',
                           _render("_('Actual OPEX')")],
                'lines': [1, 0, 'number',
                          _render("p['act_opex']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['act_opex']"), None, self.rt_cell_style_decimal
                ]
            },
            'type_target': {
                'header': [1, 22, 'text',
                           _render("_('Desc Type (TARGET)')")],
                'lines': [1, 0, 'text',
                          _render("p['type_target']")],
                'totals': [1, 22, 'text', None]
            },
            'warna_target': {
                'header': [1, 22, 'text',
                           _render("_('Warna (TARGET)')")],
                'lines': [1, 0, 'text',
                          _render("p['warna_target']")],
                'totals': [1, 22, 'text', None]
            },
            'qty_target': {
                'header': [1, 22, 'text',
                           _render("_('Target QTY')")],
                'lines': [1, 0, 'number',
                          _render("p['qty_target']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['qty_target']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'act_target': {
                'header': [1, 22, 'text',
                           _render("_('Actual QTY')")],
                'lines': [1, 0, 'number',
                          _render("p['act_target']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['act_target']"), None,
                    self.rt_cell_style_decimal
                ]
            },
            'tipe_partner': {
                'header':
                [1, 22, 'text',
                 _render("_('Tipe Partner Sharing')")],
                'lines': [1, 0, 'text',
                          _render("p['tipe_partner']")],
                'totals': [1, 22, 'text', None]
            },
            'partner': {
                'header': [1, 22, 'text',
                           _render("_('Partner Sharing')")],
                'lines': [1, 0, 'text', _render("p['partner']")],
                'totals': [1, 22, 'text', None]
            },
            'amount': {
                'header': [1, 22, 'text',
                           _render("_('Amount Sharing')")],
                'lines': [1, 0, 'number',
                          _render("p['amount']")],
                'totals': [
                    1, 22, 'number',
                    _render("p['amount']"), None, self.rt_cell_style_decimal
                ]
            },
        }
        # XLS Template
        self.col_specs_template_details = {}
예제 #39
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_streamline_ame_invoice_summary_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format +
                                                 _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template = {
            'A': {
                'header': [1, 20, 'text',
                           _render("_('Inv Date')")],
                'lines': [1, 0, 'text',
                          _render("line.get('inv_date', '')")],
                'totals': [1, 0, 'text', None]
            },
            'B': {
                'header': [1, 42, 'text',
                           _render("_('Inv No')")],
                'lines': [1, 0, 'text',
                          _render("line.get('inv_no', '')")],
                'totals': [1, 0, 'text', None]
            },
            'C': {
                'header': [1, 42, 'text',
                           _render("_('Stock Code')")],
                'lines': [1, 0, 'text',
                          _render("line.get('stock_code', '')")],
                'totals': [1, 0, 'text', None]
            },
            'D': {
                'header': [1, 13, 'text',
                           _render("_('Item Description')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.get('item_decs') and line.get('item_decs') or line.get('item_name')"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'E': {
                'header': [1, 12, 'text',
                           _render("_('Location')")],
                'lines':
                [1, 0, 'text',
                 _render("line.get('location_stock', '')")],
                'totals': [1, 0, 'text', None]
            },
            'F': {
                'header': [1, 36, 'text',
                           _render("_('CO Name')")],
                'lines': [1, 0, 'text',
                          _render("line.get('co_name', '')")],
                'totals': [1, 0, 'text', None]
            },
            'G': {
                'header': [1, 36, 'text',
                           _render("_('DO Name')")],
                'lines': [1, 0, 'text',
                          _render("line.get('do_name', '')")],
                'totals': [1, 0, 'text', None]
            },
            'H': {
                'header': [1, 12, 'text', _render("_('PO No')")],
                'lines': [1, 0, 'text',
                          _render("line.get('po_name', '')")],
                'totals': [1, 0, 'text', None]
            },
            'I': {
                'header': [1, 13, 'text',
                           _render("_('Unit Price')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.get('unit_price', None)"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'J': {
                'header': [1, 18, 'text',
                           _render("_('Balance qty')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.get('qty', None)"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'K': {
                'header': [1, 18, 'text',
                           _render("_('Amount')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.get('amount', None)"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'L': {
                'header': [1, 18, 'text', _render("_('GST')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.get('gst', None)"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
            'M': {
                'header': [1, 12, 'text',
                           _render("_('Total Amount')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.get('total', None)"), None,
                    self.aml_cell_style_decimal
                ],
                'totals': [1, 0, 'text', None]
            },
        }
예제 #40
0
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(account_journal_xls, self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(aml_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)

        # XLS Template Journal Items
        self.col_specs_lines_template = {
            'move_name': {
                'header': [1, 20, 'text', _render("_('Entry')")],
                'lines': [1, 0, 'text', _render("l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id']))")],
                'totals': [1, 0, 'text', None]},
            'move_date': {
                'header': [1, 13, 'text', _render("_('Date')")],
                'lines': [1, 0, 'date', _render("datetime.strptime(l['move_date'],'%Y-%m-%d')"), None, self.aml_cell_style_date],
                'totals': [1, 0, 'text', None]},
            'acc_code': {
                'header': [1, 12, 'text',  _render("_('Account')")],
                'lines': [1, 0, 'text', _render("l['acc_code']")],
                'totals': [1, 0, 'text', None]},
            'aml_name': {
                'header': [1, 42, 'text', _render("_('Description')")],
                'lines': [1, 0, 'text', _render("l['aml_name']")],
                'totals': [1, 0, 'text', None]},
            'period': {
                'header': [1, 12, 'text', _render("_('Period')")],
                'lines': [1, 0, 'text', _render("l['period']")],
                'totals': [1, 0, 'text', None]},
            'partner_name': {
                'header': [1, 36, 'text', _render("_('Partner')")],
                'lines': [1, 0, 'text', _render("l['partner_name']")],
                'totals': [1, 0, 'text', None]},
            'partner_ref': {
                'header': [1, 36, 'text', _render("_('Partner Reference')")],
                'lines': [1, 0, 'text', _render("l['partner_ref']")],
                'totals': [1, 0, 'text', None]},
            'date_maturity': {
                'header': [1, 13, 'text', _render("_('Maturity Date')")],
                'lines': [1, 0, _render("l['date_maturity'] and 'date' or 'text'"),
                    _render("l['date_maturity'] and datetime.strptime(l['date_maturity'],'%Y-%m-%d') or None"),
                    None, self.aml_cell_style_date],
                'totals': [1, 0, 'text', None]},
            'debit': {
                'header': [1, 18, 'text', _render("_('Debit')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("l['debit']"), None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'number', None, _render("debit_formula"), self.rt_cell_style_decimal]},
            'credit': {
                'header': [1, 18, 'text', _render("_('Credit')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("l['credit']"), None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'number', None, _render("credit_formula"), self.rt_cell_style_decimal]},
            'balance': {
                'header': [1, 18, 'text', _render("_('Balance')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', None, _render("bal_formula"), self.aml_cell_style_decimal],
                'totals': [1, 0, 'number', None, _render("bal_formula"), self.rt_cell_style_decimal]},
            'reconcile': {
                'header': [1, 12, 'text', _render("_('Rec.')"), None, self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("l['reconcile']"), None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'reconcile_partial': {
                'header': [1, 12, 'text', _render("_('Part. Rec.')"), None, self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("l['reconcile_partial']"), None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'tax_code': {
                'header': [1, 6, 'text', _render("_('VAT')"), None, self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("l['tax_code']"), None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'tax_amount': {
                'header': [1, 18, 'text', _render("_('VAT Amount')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("l['tax_amount']"), None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'amount_currency': {
                'header': [1, 18, 'text', _render("_('Am. Currency')"), None, self.rh_cell_style_right],
                'lines': [1, 0, _render("l['amount_currency'] and 'number' or 'text'"),
                    _render("l['amount_currency'] or None"),
                    None, self.aml_cell_style_decimal],
                'totals': [1, 0, 'text', None]},
            'currency_name': {
                'header': [1, 6, 'text', _render("_('Curr.')"), None, self.rh_cell_style_center],
                'lines': [1, 0, 'text', _render("l['currency_name']"), None, self.aml_cell_style_center],
                'totals': [1, 0, 'text', None]},
            'docname': {
                'header': [1, 35, 'text', _render("_('Document')")],
                'lines': [1, 0, 'text', _render("l['docname']")],
                'totals': [1, 0, 'text', None]},
            'move_ref': {
                'header': [1, 25, 'text', _render("_('Entry Reference')")],
                'lines': [1, 0, 'text', _render("l['move_ref']")],
                'totals': [1, 0, 'text', None]},
            'move_id': {
                'header': [1, 10, 'text', _render("_('Entry Id')")],
                'lines': [1, 0, 'text', _render("str(l['move_id'])")],
                'totals': [1, 0, 'text', None]},
        }

        # XLS Template VAT Summary
        self.col_specs_vat_summary_template = {
            'tax_case_name': {
                'header': [1, 45, 'text', _render("_('Description')")],
                'tax_totals': [1, 0, 'text', _render("t.name")]},
            'tax_code': {
                'header': [1, 6, 'text', _render("_('Case')")],
                'tax_totals': [1, 0, 'text', _render("t.code")]},
            'tax_amount': {
                'header': [1, 18, 'text', _render("_('Amount')"), None, self.rh_cell_style_right],
                'tax_totals': [1, 0, 'number', _render("sum_vat(o,t)"), None, self.aml_cell_style_decimal]},
        }
예제 #41
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_kinerjasa_xls, self).__init__(name, table, rml, parser,
                                                   header, store)

        # Cell Styles
        _xs = self.xls_styles

        # Report Column Headers format
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])

        # Partner Column Headers format
        fill_blue = 'pattern: pattern solid, fore_color 27;'
        ph_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.ph_cell_style = xlwt.easyxf(ph_cell_format)
        self.ph_cell_style_decimal = xlwt.easyxf(
            ph_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # Partner Column Data format
        pd_cell_format = _xs['borders_all']
        self.pd_cell_style = xlwt.easyxf(pd_cell_format)
        self.pd_cell_style_center = xlwt.easyxf(pd_cell_format + _xs['center'])
        self.pd_cell_style_date = xlwt.easyxf(
            pd_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.pd_cell_style_decimal = xlwt.easyxf(
            pd_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template_overview = {
            'no': {
                'header': [1, 5, 'text', _render("_('No')")],
                'lines': [1, 0, 'number', _render("p['no']")],
                'totals': [1, 5, 'number', None]
            },
            'nama_sa': {
                'header': [1, 32, 'text',
                           _render("_('Nama SA')")],
                'lines': [1, 0, 'text', _render("p['nama_sa']")],
                'totals': [1, 32, 'text', None]
            },
            'sum_claim': {
                'header': [1, 12, 'text', _render("_('Claim')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['sum_claim']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 12, 'number',
                    _render("p['sum_claim']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'sum_kpb': {
                'header': [1, 12, 'text', _render("_('KPB')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['sum_kpb']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 12, 'number',
                    _render("p['sum_kpb']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'sum_quickserv': {
                'header': [1, 14, 'text',
                           _render("_('Quick Service')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['sum_quickserv']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 14, 'number',
                    _render("p['sum_quickserv']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'sum_lightrep': {
                'header': [1, 14, 'text',
                           _render("_('Light Repair')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['sum_lightrep']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 14, 'number',
                    _render("p['sum_lightrep']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'sum_heavyrep': {
                'header': [1, 20, 'text',
                           _render("_('Heavy Repair')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['sum_heavyrep']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 20, 'number',
                    _render("p['sum_heavyrep']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'sum_job': {
                'header': [1, 12, 'text',
                           _render("_('Job Return')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['sum_job']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 12, 'number',
                    _render("p['sum_job']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'total': {
                'header': [1, 12, 'text', _render("_('Total')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['total']"), None,
                    xlwt.easyxf(_xs['right'])
                ],
                'totals': [
                    1, 12, 'number',
                    _render("p['total']"), None,
                    xlwt.easyxf(_xs['right'])
                ]
            },
            'jam_terpakai': {
                'header': [1, 15, 'text',
                           _render("_('Jam Terpakai')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['jam_terpakai']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 15, 'number',
                    _render("p['jam_terpakai']"), None,
                    self.pd_cell_style_decimal
                ]
            },
            'rp_jasa': {
                'header': [1, 15, 'text',
                           _render("_('Rp. Jasa')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['rp_jasa']"), None, self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 15, 'number',
                    _render("p['rp_jasa']"), None, self.pd_cell_style_decimal
                ]
            },
            'rp_sparepart': {
                'header': [1, 15, 'text',
                           _render("_('Rp. Sparepart')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['rp_sparepart']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 15, 'number',
                    _render("p['rp_sparepart']"), None,
                    self.pd_cell_style_decimal
                ]
            },
            'rp_accessories': {
                'header': [1, 15, 'text',
                           _render("_('Rp. Accessories')")],
                'lines': [
                    1, 0, 'number',
                    _render("p['rp_accessories']"), None,
                    self.pd_cell_style_decimal
                ],
                'totals': [
                    1, 15, 'number',
                    _render("p['rp_accessories']"), None,
                    self.pd_cell_style_decimal
                ]
            },
        }
예제 #42
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(report_streamline_ame_material_take_off_xls,
              self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format +
                                                 _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf(
            aml_cell_format + _xs['left'],
            num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf(
            aml_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)
        self.aml_cell_style_int = xlwt.easyxf(aml_cell_format + _xs['right'],
                                              num_format_str=int_format)
        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs['right'],
            num_format_str=report_xls.decimal_format)

        # XLS Template
        self.col_specs_template = {
            'A': {
                'header': [1, 20, 'text', _render("_('Item')")],
                'lines': [1, 0, 'text',
                          _render("line.product_id.name")],
                'totals': [1, 0, 'text', None]
            },
            'B': {
                'header': [1, 13, 'text',
                           _render("_('Required qty')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.required_qty"), None, self.aml_cell_style_int
                ],
                'totals': [1, 0, 'text', None]
            },
            'C': {
                'header': [1, 18, 'text',
                           _render("_('Purchased qty')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.purchased_qty"), None,
                    self.aml_cell_style_int
                ],
                'totals': [1, 0, 'text', None]
            },
            'D': {
                'header': [1, 18, 'text',
                           _render("_('Received qty')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.received_qty"), None, self.aml_cell_style_int
                ],
                'totals': [1, 0, 'text', None]
            },
        }
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(asset_report_xls, self).__init__(name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header

        # Report Column Headers format
        rh_cell_format = _xs["bold"] + _xs["fill"] + _xs["borders_all"]
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs["center"])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs["right"])

        # Type view Column format
        fill_blue = "pattern: pattern solid, fore_color 27;"
        av_cell_format = _xs["bold"] + fill_blue + _xs["borders_all"]
        self.av_cell_style = xlwt.easyxf(av_cell_format)
        self.av_cell_style_decimal = xlwt.easyxf(
            av_cell_format + _xs["right"], num_format_str=report_xls.decimal_format
        )

        # Type normal Column Data format
        an_cell_format = _xs["borders_all"]
        self.an_cell_style = xlwt.easyxf(an_cell_format)
        self.an_cell_style_center = xlwt.easyxf(an_cell_format + _xs["center"])
        self.an_cell_style_date = xlwt.easyxf(an_cell_format + _xs["left"], num_format_str=report_xls.date_format)
        self.an_cell_style_decimal = xlwt.easyxf(
            an_cell_format + _xs["right"], num_format_str=report_xls.decimal_format
        )

        # totals
        rt_cell_format = _xs["bold"] + _xs["fill"] + _xs["borders_all"]
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs["right"])
        self.rt_cell_style_decimal = xlwt.easyxf(
            rt_cell_format + _xs["right"], num_format_str=report_xls.decimal_format
        )

        # XLS Template
        self.acquisition_template = {
            "account": {
                "header": [1, 20, "text", _render("_('Account')")],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.category_id.account_asset_id.code")],
                "totals": [1, 0, "text", _render("_('Totals')"), None, self.rt_cell_style],
            },
            "name": {
                "header": [1, 40, "text", _render("_('Name')")],
                "asset_view": [1, 0, "text", _render("asset.name")],
                "asset": [1, 0, "text", _render("asset.name or ''")],
                "totals": [1, 0, "text", None],
            },
            "code": {
                "header": [1, 20, "text", _render("_('Reference')")],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.code or ''")],
                "totals": [1, 0, "text", None],
            },
            "date_start": {
                "header": [1, 20, "text", _render("_('Asset Start Date')")],
                "asset_view": [1, 0, "text", None],
                "asset": [
                    1,
                    0,
                    "date",
                    _render("asset.date_start and " "datetime.strptime(asset.date_start,'%Y-%m-%d') " "or None"),
                    None,
                    self.an_cell_style_date,
                ],
                "totals": [1, 0, "text", None],
            },
            "asset_value": {
                "header": [1, 18, "text", _render("_('Asset Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("asset_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.asset_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("asset_total_formula"), self.rt_cell_style_decimal],
            },
            "salvage_value": {
                "header": [1, 18, "text", _render("_('Salvage Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("salvage_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.salvage_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("salvage_total_formula"), self.rt_cell_style_decimal],
            },
        }

        self.active_template = {
            "account": {
                "header": [1, 20, "text", _render("_('Account')")],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.category_id.account_asset_id.code")],
                "totals": [1, 0, "text", _render("_('Totals')"), None, self.rt_cell_style],
            },
            "name": {
                "header": [1, 40, "text", _render("_('Name')")],
                "asset_view": [1, 0, "text", _render("asset.name")],
                "asset": [1, 0, "text", _render("asset.name or ''")],
                "totals": [1, 0, "text", None],
            },
            "code": {
                "header": [1, 20, "text", _render("_('Reference')")],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.code or ''")],
                "totals": [1, 0, "text", None],
            },
            "date_start": {
                "header": [1, 20, "text", _render("_('Asset Start Date')")],
                "asset_view": [1, 0, "text", None],
                "asset": [
                    1,
                    0,
                    "date",
                    _render("asset.date_start and " "datetime.strptime(asset.date_start,'%Y-%m-%d') " "or None"),
                    None,
                    self.an_cell_style_date,
                ],
                "totals": [1, 0, "text", None],
            },
            "asset_value": {
                "header": [1, 18, "text", _render("_('Asset Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("asset_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.asset_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("asset_total_formula"), self.rt_cell_style_decimal],
            },
            "salvage_value": {
                "header": [1, 18, "text", _render("_('Salvage Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("salvage_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.salvage_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("salvage_total_formula"), self.rt_cell_style_decimal],
            },
            "fy_start_value": {
                "header": [1, 18, "text", _render("_('FY Start Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("fy_start_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.fy_start_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("fy_start_total_formula"), self.rt_cell_style_decimal],
            },
            "fy_depr": {
                "header": [1, 18, "text", _render("_('FY Depreciation')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("fy_diff_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", None, _render("fy_diff_formula"), self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("fy_diff_formula"), self.rt_cell_style_decimal],
            },
            "fy_end_value": {
                "header": [1, 18, "text", _render("_('FY End Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("fy_end_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.fy_end_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("fy_end_total_formula"), self.rt_cell_style_decimal],
            },
            "fy_end_depr": {
                "header": [1, 18, "text", _render("_('Tot. Depreciation')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("total_depr_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", None, _render("total_depr_formula"), self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("total_depr_formula"), self.rt_cell_style_decimal],
            },
            "method": {
                "header": [1, 20, "text", _render("_('Comput. Method')"), None, self.rh_cell_style_center],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.method or ''"), None, self.an_cell_style_center],
                "totals": [1, 0, "text", None],
            },
            "method_number": {
                "header": [1, 20, "text", _render("_('Number of Years')"), None, self.rh_cell_style_center],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "number", _render("asset.method_number"), None, self.an_cell_style_center],
                "totals": [1, 0, "text", None],
            },
            "prorata": {
                "header": [1, 20, "text", _render("_('Prorata Temporis')"), None, self.rh_cell_style_center],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "bool", _render("asset.prorata")],
                "totals": [1, 0, "text", None],
            },
        }

        self.removal_template = {
            "account": {
                "header": [1, 20, "text", _render("_('Account')")],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.category_id.account_asset_id.code")],
                "totals": [1, 0, "text", _render("_('Totals')"), None, self.rt_cell_style],
            },
            "name": {
                "header": [1, 40, "text", _render("_('Name')")],
                "asset_view": [1, 0, "text", _render("asset.name")],
                "asset": [1, 0, "text", _render("asset.name or ''")],
                "totals": [1, 0, "text", None],
            },
            "code": {
                "header": [1, 20, "text", _render("_('Reference')")],
                "asset_view": [1, 0, "text", None],
                "asset": [1, 0, "text", _render("asset.code or ''")],
                "totals": [1, 0, "text", None],
            },
            "date_remove": {
                "header": [1, 20, "text", _render("_('Asset Removal Date')")],
                "asset_view": [1, 0, "text", None],
                "asset": [
                    1,
                    0,
                    "date",
                    _render("asset.date_remove and " "datetime.strptime(asset.date_remove,'%Y-%m-%d') " "or None"),
                    None,
                    self.an_cell_style_date,
                ],
                "totals": [1, 0, "text", None],
            },
            "asset_value": {
                "header": [1, 18, "text", _render("_('Asset Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("asset_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.asset_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("asset_total_formula"), self.rt_cell_style_decimal],
            },
            "salvage_value": {
                "header": [1, 18, "text", _render("_('Salvage Value')"), None, self.rh_cell_style_right],
                "asset_view": [1, 0, "number", None, _render("salvage_formula"), self.av_cell_style_decimal],
                "asset": [1, 0, "number", _render("asset.salvage_value"), None, self.an_cell_style_decimal],
                "totals": [1, 0, "number", None, _render("salvage_total_formula"), self.rt_cell_style_decimal],
            },
        }
    def __init__(self, name, table, rml=False, parser=False, header=True,
                 store=False):
        super(sale_order_xls, self).__init__(  name, table, rml, parser, header, store)

        # Cell Styles
        _xs = self.xls_styles
        # header
        rh_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rh_cell_style = xlwt.easyxf(rh_cell_format)
        self.rh_cell_style_center = xlwt.easyxf(rh_cell_format + _xs['center'])
        self.rh_cell_style_right = xlwt.easyxf(rh_cell_format + _xs['right'])
        # lines
        aml_cell_format = _xs['borders_all']
        self.aml_cell_style = xlwt.easyxf(aml_cell_format)
        self.aml_cell_style_center = xlwt.easyxf(aml_cell_format + _xs['center'])
        self.aml_cell_style_date = xlwt.easyxf( aml_cell_format + _xs['left'], num_format_str=report_xls.date_format)
        self.aml_cell_style_decimal = xlwt.easyxf( aml_cell_format + _xs['right'],  num_format_str=report_xls.decimal_format)

        # totals
        rt_cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
        self.rt_cell_style = xlwt.easyxf(rt_cell_format)
        self.rt_cell_style_right = xlwt.easyxf(rt_cell_format + _xs['right'])
        self.rt_cell_style_decimal = xlwt.easyxf( rt_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)

        self.col_specs_template = {
            'so_date': {
                'header': [1, 12, 'text', _render("_('Sale Order Date')")],
                'lines': [1, 0, 'text', _render("line.so_date or ''")]
                },
            'customer': {
                'header': [1, 12, 'text', _render("_('Customer')")],
                'lines': [1, 0, 'text', _render("line.customer.name or ''")]
            },
            'model': {
                'header': [1, 12, 'text', _render("_('Model')")],
                'lines': [1, 0, 'text', _render("line.model.name or ''")]
            },
            'description': {
                'header': [1, 12, 'text', _render("_('Description')")],
                'lines': [1, 0, 'text', _render("line.description or ''")]
            },
            'model_width': {
                'header': [1, 12, 'text', _render("_('Width')")],
                'lines': [1, 0, 'number', _render("line.model_width or ''")]
            },
            'model_length': {
                'header': [1, 12, 'text', _render("_('Length')")],
                'lines': [1, 0, 'number', _render("line.model_length or ''")]
            },
            'model_gusset': {
                'header': [1, 12, 'text', _render("_('Gusset')")],
                'lines': [1, 0, 'number', _render("line.model_gusset or ''")]
            },
            'model_flap': {
                'header': [1, 12, 'text', _render("_('Flap')")],
                'lines': [1, 0, 'number', _render("line.model_flap or ''")]
            },
            'model_uom': {
                'header': [1, 12, 'text', _render("_('UOM')")],
                'lines': [1, 0, 'text', _render("line.model_uom.name or ''")]
            },
            'model_quantity': {
                'header': [1, 12, 'text', _render("_('Quantity')")],
                'lines': [1, 0, 'number', _render("line.model_quantity or ''")]
            },
            'model_unit_price': {
                'header': [1, 12, 'text', _render("_('Unit Price')")],
                'lines': [1, 0, 'number', _render("line.model_unit_price or ''")]
            },
            'so_amount': {
                'header': [1, 12, 'text', _render("_('Amount')")],
                'lines': [1, 0, 'number', _render("line.so_amount or ''")]
            },
            'pi_no': {
                'header': [1, 12, 'text', _render("_('PI No.')")],
                'lines': [1, 0, 'text', _render("line.pi_no or ''")]
            },
            'so_retailer': {
                'header': [1, 12, 'text', _render("_('Retailer')")],
                'lines': [1, 0, 'text', _render("line.so_retailer.name or ''")]
            }
                # 'model_width','model_length','model_gusset', 'model_flap','model_uom','model_quantity','model_unit_price','so_amount','pi_no','so_retailer'
            # 'sale_order_line.product_id': {
            #     'header': [1, 42, 'text', _render("_('Product ID')")],
                # 'lines': [1, 0, 'text', _render("line.product_id.name_template or ''")]
                # },
            # 'unit': {
            #     'header': [1, 20, 'text', _render("_('Unit of measure')")],
            #     # 'lines': [1, 0, 'text', _render("'PCS'")]
            #     },
            # 'product_qty': {
            #     'header': [1, 10, 'text', _render("_('Quantity')"), None, self.rh_cell_style_right],
            #     # 'lines': [1, 0, 'number', _render("line.product_qty")]
            #     },
        }