def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(account_invoice_line_xls_kaiser_compliance,
              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_kaiser_compliance = {
            'id': {
                'header': [1, 10, 'text', _render("_('ID')")],
                'lines': [1, 0, 'number',
                          _render("line.invoice_id.id ")],
                'totals': [1, 0, 'text', None]
            },
            'date_service': {
                'header': [1, 10, 'text',
                           _render("_('Date Service')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.event_start_date) or '' "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'language': {
                'header': [1, 13, 'text',
                           _render("_('Language')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.language_id and line.invoice_id.event_id.language_id.name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpretation_type': {
                'header': [1, 20, 'text',
                           _render("_('Interpretation Type')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.appointment_type_id and line.invoice_id.event_id.appointment_type_id.name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpreter': {
                'header': [1, 20, 'text',
                           _render("_('Interpreter Name')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.task_line_id and line.task_line_id.interpreter_id and line.task_line_id.interpreter_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpretation_city': {
                'header': [1, 13, 'text',
                           _render("_('Job Loc. City')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.city or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'patient_name': {
                'header': [1, 15, 'text',
                           _render("_('Patient Name')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.patient_id and line.invoice_id.event_id.patient_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'requester': {
                'header': [1, 20, 'text',
                           _render("_('Requester')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.ordering_partner_id and line.invoice_id.event_id.ordering_partner_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'ordering_contact': {
                'header': [1, 20, 'text',
                           _render("_('Ordering Contact')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.ordering_contact_id and line.invoice_id.event_id.ordering_contact_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_customer': {
                'header': [1, 20, 'text',
                           _render("_('Billing Customer')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.partner_id and line.invoice_id.event_id.partner_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_customer_ref': {
                'header':
                [1, 13, 'text',
                 _render("_('Billing Customer Ref')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.partner_id and line.invoice_id.event_id.partner_id.ref or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_contact': {
                'header': [1, 20, 'text',
                           _render("_('Billing Contact')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.contact_id and line.invoice_id.event_id.contact_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_contact_ref': {
                'header': [1, 13, 'text',
                           _render("_('Billing Contact Ref')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.contact_id and line.invoice_id.event_id.contact_id.ref or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            #            'address': {
            #                'header': [1, 30, 'text', _render("_('Address')")],
            #                'lines': [1, 0, 'text', self.parse_address('',_render("line.invoice_id.partner_id.street or '' "),_render("line.invoice_id.partner_id.street2 or '' "))],
            #                'totals': [1, 0, 'text', None]},
            'address': {
                'header': [1, 30, 'text',
                           _render("_('Address')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render("line.invoice_id.partner_id.street or '' "))
                ],
                'totals': [1, 0, 'text', None]
            },
            'city': {
                'header': [1, 13, 'text', _render("_('City')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render("line.invoice_id.partner_id.city or '' "))
                ],
                'totals': [1, 0, 'text', None]
            },
            'zip': {
                'header': [1, 10, 'text', _render("_('Zip')")],
                'lines': [
                    1, 0, 'text',
                    _render("line.invoice_id.partner_id.zip or '' ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'location': {
                'header':
                [1, 25, 'text',
                 _render("_('Location Services Provided')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.name or '' "
                        ))
                ],
                #                                                _render("line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.street or '' "),\
                #                                                _render("line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.street2 or '' "))],
                'totals': [1, 0, 'text', None]
            },
            'street': {
                'header': [1, 25, 'text',
                           _render("_('Street')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.street or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'street2': {
                'header': [1, 25, 'text',
                           _render("_('Street2')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.street2 or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'start_time': {
                'header': [1, 10, 'text',
                           _render("_('Start Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.task_line_id and str(line.task_line_id.event_start_hr or '') + ':' + str(line.task_line_id.event_start_min or '') + ' ' + \
                                        str(line.task_line_id.am_pm or '') or '' #"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'end_time': {
                'header': [1, 10, 'text',
                           _render("_('End Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.task_line_id and str(line.task_line_id.event_end_hr or '') + ':' + str(line.task_line_id.event_end_min or '') + ' ' + \
                                        str(line.task_line_id.am_pm2 or '') or '' #"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'duration': {
                'header': [1, 10, 'text',
                           _render("_('Duration')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.task_line_id and line.task_line_id.time_spent and str(round(line.task_line_id.time_spent,2) or '')or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'rate': {
                'header': [1, 10, 'text',
                           _render("_('AR Unit(Hourly)')")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "line.price_unit and round(line.price_unit,2) or 0.0 ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'miles_driven': {
                'header': [1, 10, 'text',
                           _render("_('Miles Driven')")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "line.miles_driven and round(line.miles_driven,2)or 0.0 "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'total_miles_rate': {
                'header': [1, 13, 'text',
                           _render("_('Total Miles Cost')")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "round(line.mileage * line.mileage_rate,2)  or 0.0 ")
                ],
                'totals': [1, 0, 'text', None]
            },
            #datetime.strptime(datetime.strptime(dt_from,"%Y-%m-%d").strftime('%Y-%m-%d %H:%M:%S'), "%Y-%m-%d %H:%M:%S")
            'invoice_number': {
                'header': [1, 13, 'text',
                           _render("_('Invoice Number')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.invoice_old_number and str(line.invoice_id.invoice_old_number) or str(line.invoice_id.number) or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'office': {
                'header': [1, 15, 'text',
                           _render("_('Office')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'interpreter_gender': {
                'header': [1, 10, 'text',
                           _render("_('Intp Gender')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and line.invoice_id.event_id.interpreter_id and \
                                        str(line.invoice_id.event_id.interpreter_id.gender) or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'po_no': {
                'header': [1, 13, 'text', _render("_('PO#')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and line.invoice_id.event_id.po_no or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'medical_number': {
                'header': [1, 13, 'text', _render("_('MRN#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.medical_no or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'contract_no': {
                'header': [1, 13, 'text',
                           _render("_('Contract#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.ordering_partner_id and line.invoice_id.ordering_partner_id.contract_no or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'date_invoice': {
                'header': [1, 10, 'text',
                           _render("_('Invoice Date')")],
                'lines': [
                    1, 0, 'text',
                    _render("str(line.invoice_id.date_invoice or '') or ''")
                ],
                'totals': [1, 0, 'text', None]
            },
            'amount': {
                'header': [
                    1, 10, 'text',
                    _render("_('Total Of Services')"), None,
                    self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "line.price_subtotal and round(line.price_subtotal,2) or 0.0 "
                    )
                ],
                'totals': [
                    1, 0, 'number', None,
                    _render("amount_total_formula"), self.rt_cell_style_decimal
                ]
            },
            'comment': {
                'header': [1, 40, 'text',
                           _render("_('Comment')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render("line.invoice_id.comment or ''"))
                ],
                'totals': [1, 0, 'text', None]
            },
            'event_purpose': {
                'header': [1, 13, 'text',
                           _render("_('Event Purpose')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.event_purpose or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'event_number': {
                'header': [1, 13, 'text',
                           _render("_('Event Number')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'event_outcome': {
                'header': [1, 20, 'text',
                           _render("_('Job Status')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.task_line_id and line.task_line_id.event_out_come_id and line.task_line_id.event_out_come_id.name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'cancel_reason': {
                'header': [1, 20, 'text',
                           _render("_('Cancellation Reason')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.cancel_reason_id and line.invoice_id.event_id.cancel_reason_id.name or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'glcode': {
                'header': [
                    1, 15, 'text',
                    _render("_('GL String/NCOA code/Cost Center#')")
                ],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.cust_gpuid or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'nuid': {
                'header': [1, 15, 'text',
                           _render("_('FDA NUID#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.cust_csid or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'requested_start_time': {
                'header':
                [1, 10, 'text',
                 _render("_('Requested Start Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.event_start_hr or '') + ':' + str(line.invoice_id.event_id.event_start_min or '') + ' ' + \
                                        str(line.invoice_id.event_id.am_pm or '') or '' #"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'requested_end_time': {
                'header': [1, 10, 'text',
                           _render("_('Requested End Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.event_end_hr or '') + ':' + str(line.invoice_id.event_id.event_end_min or '') + ' ' + \
                                        str(line.invoice_id.event_id.am_pm2 or '') or '' #"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'billed_duration': {
                'header': [1, 10, 'text',
                           _render("_('Billed Duration')")],
                'lines': [
                    1, 0, 'number',
                    _render("line.quantity and round(line.quantity,2) or 0.0 ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'create_date': {
                'header': [1, 10, 'text',
                           _render("_('Intake date')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.create_date or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'less_than_24_notice': {
                'header': [1, 10, 'text',
                           _render("_('< 24 notice')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.intake_notice or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'total_interpretation_cost': {
                'header': [1, 13, 'text',
                           _render("_('AR Total Amount')")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "round(line.quantity * line.price_unit,2)  or 0.0 ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'multi_type': {
                'header': [1, 13, 'text',
                           _render("_('Bundled Appointment')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "'Two interpreters assigned for event' if line.invoice_id.event_id and line.invoice_id.event_id.multi_type and line.invoice_id.event_id.multi_type == '2' else '' "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'comments': {
                'header': [1, 13, 'text',
                           _render("_('Comments')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'payment_received': {
                'header': [1, 10, 'text',
                           _render("_('Payment Received')")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "round(line.invoice_id.amount_total - line.invoice_id.residual,2) or 0.0 "
                    )
                ],
                'totals': [1, 0, 'number', None, None]
            },
            'status': {
                'header': [1, 15, 'text',
                           _render("_('Status')")],
                'lines':
                [1, 0, 'text',
                 _render("line.invoice_id.state or '' ")],
                'totals': [1, 0, 'text', None]
            },
            'department': {
                'header': [1, 15, 'text',
                           _render("_('Department')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.department or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'dr_name': {
                'header': [1, 15, 'text',
                           _render("_('Doctor Name')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.dr_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'patient_medical_number': {
                'header': [1, 13, 'text',
                           _render("_('Patient Medical#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "line.invoice_id.event_id and line.invoice_id.event_id.patient_id and line.invoice_id.event_id.patient_id.ssnid or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
        }
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(account_invoice_xls_invoice_profitability,
              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_invoice_profitability = {
            'id': {
                'header': [1, 10, 'text', _render("_('ID')")],
                'lines': [1, 0, 'number',
                          _render("each_line.invoice_id.id ")],
                'totals': [1, 0, 'text', None]
            },
            'date_service': {
                'header': [1, 10, 'text',
                           _render("_('Date Service')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.invoice_id.event_id and str(each_line.invoice_id.event_id.event_start_date) or '' "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'language': {
                'header': [1, 13, 'text',
                           _render("_('Language')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.language_id and each_line.invoice_id.event_id.language_id.name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpretation_type': {
                'header': [1, 20, 'text',
                           _render("_('Interpretation Type')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.appointment_type_id and each_line.invoice_id.event_id.appointment_type_id.name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpreter': {
                'header': [1, 20, 'text',
                           _render("_('Interpreter Name')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.task_line_id and each_line.task_line_id.interpreter_id and each_line.task_line_id.interpreter_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpretation_city': {
                'header': [1, 13, 'text',
                           _render("_('Interpretation City')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.location_id and each_line.invoice_id.event_id.location_id.city or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'interpretation_state': {
                'header':
                [1, 13, 'text',
                 _render("_('Interpretation state')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.location_id and each_line.invoice_id.event_id.location_id.state_id.name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'patient_name': {
                'header': [1, 15, 'text',
                           _render("_('Patient Name')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.patient_id and each_line.invoice_id.event_id.patient_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'requester': {
                'header': [1, 20, 'text',
                           _render("_('Requester')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.ordering_partner_id and each_line.invoice_id.event_id.ordering_partner_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'ordering_contact': {
                'header': [1, 20, 'text',
                           _render("_('Ordering Contact')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.ordering_contact_id and each_line.invoice_id.event_id.ordering_contact_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'ordering_contact_phone': {
                'header': [1, 20, 'text',
                           _render("_('Phone No')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.ordering_contact_id and each_line.invoice_id.event_id.ordering_contact_id.phone or each_line.invoice_id.event_id.ordering_contact_id.phone2 or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_customer': {
                'header': [1, 20, 'text',
                           _render("_('Billing Customer')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.partner_id and each_line.invoice_id.event_id.partner_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_customer_ref': {
                'header':
                [1, 13, 'text',
                 _render("_('Billing Customer Ref')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.partner_id and each_line.invoice_id.event_id.partner_id.ref or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_contact': {
                'header': [1, 20, 'text',
                           _render("_('Billing Contact')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.contact_id and each_line.invoice_id.event_id.contact_id.complete_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'billing_contact_ref': {
                'header': [1, 13, 'text',
                           _render("_('Billing Contact Ref')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.contact_id and each_line.invoice_id.event_id.contact_id.ref or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            #            'address': {
            #                'header': [1, 30, 'text', _render("_('Address')")],
            #                'lines': [1, 0, 'text', self.parse_address('',_render("line.invoice_id.partner_id.street or '' "),_render("line.invoice_id.partner_id.street2 or '' "))],
            #                'totals': [1, 0, 'text', None]},
            'address': {
                'header': [1, 30, 'text',
                           _render("_('Address')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.partner_id.street or '' "))
                ],
                'totals': [1, 0, 'text', None]
            },
            'city': {
                'header': [1, 13, 'text', _render("_('City')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render("each_line.invoice_id.partner_id.city or '' "))
                ],
                'totals': [1, 0, 'text', None]
            },
            'zip': {
                'header': [1, 10, 'text', _render("_('Zip')")],
                'lines': [
                    1, 0, 'text',
                    _render("each_line.invoice_id.partner_id.zip or '' ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'location': {
                'header':
                [1, 25, 'text',
                 _render("_('Location Services Provided')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.location_id and each_line.invoice_id.event_id.location_id.name or '' "
                        ))
                ],
                #                                                _render("line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.street or '' "),\
                #                                                _render("line.invoice_id.event_id and line.invoice_id.event_id.location_id and line.invoice_id.event_id.location_id.street2 or '' "))],
                'totals': [1, 0, 'text', None]
            },
            'street': {
                'header': [1, 25, 'text',
                           _render("_('Street')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.location_id and each_line.invoice_id.event_id.location_id.street or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'street2': {
                'header': [1, 25, 'text',
                           _render("_('Street2')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.location_id and each_line.invoice_id.event_id.location_id.street2 or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'start_time': {
                'header': [1, 10, 'text',
                           _render("_('Start Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.task_line_id and str(each_line.task_line_id.event_start_hr or '') + ':' + str(each_line.task_line_id.event_start_min or '') + ' ' + \
                                        str(each_line.task_line_id.am_pm or '') or '' #"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'end_time': {
                'header': [1, 10, 'text',
                           _render("_('End Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.task_line_id and str(each_line.task_line_id.event_end_hr or '') + ':' + str(each_line.task_line_id.event_end_min or '') + ' ' + \
                                        str(each_line.task_line_id.am_pm2 or '') or '' #"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'duration': {
                'header': [1, 10, 'text',
                           _render("_('Duration')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.task_line_id and each_line.task_line_id.time_spent and str(round(each_line.task_line_id.time_spent,2) or '')or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'rate': {
                'header': [1, 10, 'text',
                           _render("_('Interpreter Rate')")],
                # 'lines': [1, 0, 'number', _render("line.price_unit and round(line.price_unit,2) or 0.0 ")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "rec_supplier_inv and round(rec_supplier_inv) or 0 ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'miles_driven': {
                'header': [1, 10, 'text',
                           _render("_('Miles Driven')")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "each_line.miles_driven and round(each_line.miles_driven,2)or 0.0 "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'total_miles_rate': {
                'header': [1, 13, 'text',
                           _render("_('Total Miles Rate')")],
                #'lines': [1, 0, 'number', _render("round(each_line.mileage * each_line.mileage_rate,2)  or 0.0 ")],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "rec_supplier_mileage * rec_supplier_mileage_rate or 0.0 "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            # datetime.strptime(datetime.strptime(dt_from,"%Y-%m-%d").strftime('%Y-%m-%d %H:%M:%S'), "%Y-%m-%d %H:%M:%S")
            'invoice_number': {
                'header': [1, 13, 'text',
                           _render("_('Invoice Number')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render("str(each_line.invoice_id.number) or ''"))
                ],
                'totals': [1, 0, 'text', None]
            },
            'office': {
                'header': [1, 15, 'text',
                           _render("_('Office')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'interpreter_gender': {
                'header': [1, 10, 'text',
                           _render("_('Intp Gender')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.invoice_id.event_id and each_line.invoice_id.event_id.interpreter_id and \
                                        str(each_line.invoice_id.event_id.interpreter_id.gender) or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'po_no': {
                'header': [1, 13, 'text', _render("_('PO#')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.invoice_id.event_id and each_line.invoice_id.event_id.po_no or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'medical_number': {
                'header': [1, 13, 'text',
                           _render("_('Medical#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.medical_no or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'contract_no': {
                'header': [1, 13, 'text',
                           _render("_('Contract#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.ordering_partner_id and each_line.invoice_id.ordering_partner_id.contract_no or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'date_invoice': {
                'header': [1, 10, 'text',
                           _render("_('Invoice Date')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "str(each_line.invoice_id.date_invoice or '') or ''")
                ],
                'totals': [1, 0, 'text', None]
            },
            'amount': {
                'header': [
                    1, 10, 'text',
                    _render("_('Amount')"), None, self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number',
                    _render(
                        "each_line.price_subtotal and round(each_line.price_subtotal,2) or 0.0 "
                    )
                ],
                'totals': [
                    1, 0, 'number', None,
                    _render("amount_total_formula"), self.rt_cell_style_decimal
                ]
            },
            'comment': {
                'header': [1, 40, 'text',
                           _render("_('Comment')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render("each_line.invoice_id.comment or ''"))
                ],
                'totals': [1, 0, 'text', None]
            },
            'event_purpose': {
                'header': [1, 13, 'text',
                           _render("_('Event Purpose')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "each_line.invoice_id.event_id and str(each_line.invoice_id.event_id.event_purpose or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'cost_center': {
                'header': [1, 40, 'text',
                           _render("_('Cost Center')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.cost_center or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'status': {
                'header': [1, 15, 'text',
                           _render("_('Status')")],
                'lines':
                [1, 0, 'text',
                 _render("each_line.invoice_id.state or '' ")],
                'totals': [1, 0, 'text', None]
            },
            'department': {
                'header': [1, 15, 'text',
                           _render("_('Department')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.department or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'dr_name': {
                'header': [1, 15, 'text',
                           _render("_('Doctor Name')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.dr_name or '' "
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'patient_medical_number': {
                'header': [1, 13, 'text',
                           _render("_('Patient Medical#')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.patient_id and each_line.invoice_id.event_id.patient_id.ssnid or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'amount_total': {
                'header': [1, 16, 'text',
                           _render("_('Total Vendor Pay')")],
                'lines': [
                    1, 0, 'number',
                    self.parse_unicode(_render("rec_supplier_total or 0.0 "))
                ],
                'totals': [1, 0, 'text', None]
            },
            'sales_representative_id': {
                'header': [1, 13, 'text',
                           _render("_('Sales Rep')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.sales_representative_id and each_line.invoice_id.event_id.sales_representative_id.name or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'sales_representative_id_for_billing_customer': {
                'header': [1, 13, 'text',
                           _render("_('Sales Rep By Cust')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.partner_id and each_line.invoice_id.event_id.partner_id.sales_representative_id and each_line.invoice_id.event_id.partner_id.sales_representative_id.name or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'requester_create_date': {
                'header':
                [1, 20, 'text',
                 _render("_('Requester Create Date')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "datetime.strptime(each_line.invoice_id.event_id.ordering_partner_id.create_date,'%Y-%m-%d %H:%M:%S').strftime('%m/%d/%Y') if  each_line.invoice_id.event_id and each_line.invoice_id.event_id.ordering_partner_id and each_line.invoice_id.event_id.ordering_partner_id.create_date !='False' else ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'metazone': {
                'header': [1, 20, 'text',
                           _render("_('Metazone')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.zone_id and each_line.invoice_id.event_id.zone_id.name or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
            'scheduler': {
                'header': [1, 20, 'text',
                           _render("_('Scheduler')")],
                'lines': [
                    1, 0, 'text',
                    self.parse_unicode(
                        _render(
                            "each_line.invoice_id.event_id and each_line.invoice_id.event_id.scheduler_id and each_line.invoice_id.event_id.scheduler_id.name or ''"
                        ))
                ],
                'totals': [1, 0, 'text', None]
            },
        }
示例#3
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")]
            },
        }
    def __init__(self, name, table, rml=False, parser=False, header=True, store=False):
        super(account_invoice_xls_kaiser, 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 = {
            'id': {
                'header': [1, 10, 'text', _render("_('ID')")],
                'lines': [1, 0, 'number', _render("line.id  ")],
                'totals': [1, 0, 'text', None]},
            'invoice_number': {
                'header': [1, 15, 'text', _render("_('Invoice Number')")],
                'lines': [1, 0, 'text', _render("line.number or ''")],
                'totals': [1, 0, 'text', None]},
            'date_service': {
                'header': [1, 12, 'text', _render("_('Date Service')")],
                'lines': [1, 0, 'text', _render("line.event_id and str(line.event_id.event_start_date) or ''")],
                'totals': [1, 0, 'text', None]},
            'date_invoice': {
                'header': [1, 12, 'text', _render("_('Invoice Date')")],
                'lines': [1, 0, 'text', _render("line.date_invoice or ''")],
                'totals': [1, 0, 'text', None]},
            'event_ref': {
                'header': [1, 10, 'text', _render("_('Event No')")],
                'lines': [1, 0, 'text', _render("line.event_id and line.event_id.name or ''")],
                'totals': [1, 0, 'text', None]},
            'language': {
                'header': [1, 15, 'text', _render("_('Language')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.language_id and line.event_id.language_id.name or '' "))],
                'totals': [1, 0, 'text', None]},
            'amount': {
                'header': [1, 10, 'text', _render("_('Amount')"), None, self.rh_cell_style_right],
                'lines': [1, 0, 'number', _render("round(line.residual,2) or 0.0 ")],
                'totals': [1, 0, 'number', None, _render("amount_total_formula"), self.rt_cell_style_decimal]},
            'payment_received': {
                'header': [1, 10, 'text', _render("_('Payment Received')")],
                'lines': [1, 0, 'number', _render("round(line.amount_total - line.residual,2) or 0.0 ")],
                'totals': [1, 0, 'number', None, _render("payment_total_formula"), self.rt_cell_style_decimal]},
            'address': {
                'header': [1, 30, 'text', _render("_('Address')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.partner_id and line.partner_id.street or '' "))],
                'totals': [1, 0, 'text', None]},
            'city': {
                'header': [1, 13, 'text', _render("_('City')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.partner_id and line.partner_id.city or '' "))],
                'totals': [1, 0, 'text', None]},
            'zip': {
                'header': [1, 10, 'text', _render("_('Zip')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.partner_id and line.partner_id.zip or '' "))],
                'totals': [1, 0, 'text', None]},
            'service_area': {
                'header': [1, 15, 'text', _render("_('Service Area')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]},
            'gl': {
                'header': [1, 15, 'text', _render("_('GL#')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.cust_gpuid or '' "))],
                'totals': [1, 0, 'text', None]},
            'nud': {
                'header': [1, 15, 'text', _render("_('NUD#')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.cust_csid or '' "))],
                'totals': [1, 0, 'text', None]},
            'approving_mgr': {
                'header': [1, 15, 'text', _render("_('Approving Mgr')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.approving_mgr or '' "))],
                'totals': [1, 0, 'text', None]},
            'department': {
                'header': [1, 15, 'text', _render("_('Department')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.department or '' "))],
                'totals': [1, 0, 'text', None]},
            'check': {
                'header': [1, 10, 'text', _render("_('Check#')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]},
            'check_date': {
                'header': [1, 10, 'text', _render("_('Check date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]},
            'status': {
                'header': [1, 15, 'text', _render("_('Status')")],
                'lines': [1, 0, 'text', _render("line.state or '' ")],
                'totals': [1, 0, 'text', None]},
            'po_no': {
                'header': [1, 13, 'text', _render("_('PO#')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.po_no or ''"))],
                'totals': [1, 0, 'text', None]},
            'contract_no': {
                'header': [1, 13, 'text', _render("_('Contract#')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.ordering_partner_id and line.ordering_partner_id.contract_no or '' "))],
                'totals': [1, 0, 'text', None]},
            'iu_actions': {
                'header': [1, 42, 'text', _render("_('IU Actions')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.comment or '' "))],
                'totals': [1, 0, 'text', None]},
            'event_purpose': {
                'header': [1, 13, 'text', _render("_('Event Purpose')")],
                'lines': [1, 0, 'text', _render("line.event_id and str(line.event_id.event_purpose or '') or ''")],
                'totals': [1, 0, 'text', None]},
            'department': {
                'header': [1, 15, 'text', _render("_('Department')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.department or '' "))],
                'totals': [1, 0, 'text', None]},
            'dr_name': {
                'header': [1, 15, 'text', _render("_('Doctor Name')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.dr_name or '' "))],
                'totals': [1, 0, 'text', None]},
            'patient_medical_number': {
                'header': [1, 13, 'text', _render("_('Patient Medical#')")],
                'lines': [1, 0, 'text', self.parse_unicode(_render("line.event_id and line.event_id.patient_id and line.event_id.patient_id.ssnid or ''"))],
                'totals': [1, 0, 'text', None]},
        }
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(account_invoice_xls_fcci_translation,
              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 = {
            'id': {
                'header': [1, 10, 'text', _render("_('ID')")],
                'lines': [1, 0, 'number', _render("line.id  ")],
                'totals': [1, 0, 'text', None]
            },
            'invoice_number': {
                'header': [1, 15, 'text',
                           _render("_('Invoice Number')")],
                'lines': [1, 0, 'text',
                          _render("line.name or ''")],
                'totals': [1, 0, 'text', None]
            },
            'payer': {
                'header': [1, 12, 'text', _render("_('Payer')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.partner_id and str(line.partner_id.name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'branch': {
                'header': [1, 12, 'text',
                           _render("_('Branch')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'date_of_service': {
                'header': [1, 10, 'text',
                           _render("_('Date of Service')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claimant': {
                'header': [1, 10, 'text',
                           _render("_('Claimant')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.event_id and line.event_id.patient_id and str(line.event_id.patient_id.complete_name or '')  or '' "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'adjuster': {
                'header': [1, 15, 'text',
                           _render("_('Adjuster')")],
                'lines': [
                    1, 0, 'text',
                    _render("line.event_id and line.event_id.contact_id and \
                                                str(line.event_id.contact_id.complete_name) or ''"
                            )
                ],
                'totals': [1, 0, 'text', None]
            },
            'job_outcome': {
                'header': [1, 10, 'text',
                           _render("_('Job Outcome')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.event_id and line.event_id.event_out_come_id and \
                                                str(line.event_id.event_out_come_id.name) or ''"
                    )
                ],
                'totals': [1, 0, 'number', None, None]
            },
            'transport_type': {
                'header': [1, 10, 'text',
                           _render("_('Transport Type')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.event_id and str(line.event_id.transportation_type or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None, None]
            },
            'claim_number': {
                'header': [1, 15, 'text',
                           _render("_('Claim Number')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.event_id and str(line.event_id.claim_no or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'stardard': {
                'header': [1, 15, 'text',
                           _render("_('Stardard')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'billed': {
                'header': [1, 15, 'text',
                           _render("_('Billed')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'saving': {
                'header': [
                    1, 10, 'text',
                    _render("_('Saving')"), None, self.rh_cell_style_right
                ],
                'lines': [1, 0, 'text', None],
                'totals': [
                    1, 0, 'number', None,
                    _render("amount_total_formula"), self.rt_cell_style_decimal
                ]
            },
            'vehicle_type': {
                'header': [1, 10, 'text',
                           _render("_('Vehicle Type')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None, None]
            },
            'referral_state': {
                'header': [1, 15, 'text',
                           _render("_('Referral State')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'description': {
                'header': [1, 15, 'text',
                           _render("_('Description')")],
                'lines':
                [1, 0, 'text',
                 _render("str(line.comment or '') or ''")],
                'totals': [1, 0, 'text', None]
            },
            'langauge_service_type': {
                'header':
                [1, 15, 'text',
                 _render("_('Langauge Service Type')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.event_id and line.event_id.lang_service_type or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'facility': {
                'header': [1, 15, 'text',
                           _render("_('Facility')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
        }
示例#6
0
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(account_invoice_line_xls_hartford,
              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_hartford = {
            'vendor': {
                'header': [1, 10, 'text',
                           _render("_('Vendor')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.partner_id and str(line.invoice_id.partner_id.complete_name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'claim_number': {
                'header': [1, 10, 'text',
                           _render("_('Claim Number')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.claim_no or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'segment': {
                'header': [1, 13, 'text',
                           _render("_('Segment')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claim_office': {
                'header': [1, 20, 'text',
                           _render("_('Claim Office')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'requestor_name': {
                'header': [1, 20, 'text',
                           _render("_('Requestor Name')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and line.invoice_id.event_id.ordering_partner_id and \
                                            str(line.invoice_id.event_id.ordering_partner_id.complete_name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'claim_handler_name': {
                'header': [1, 13, 'text',
                           _render("_('Claim Handler Name')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claim_name': {
                'header': [1, 15, 'text',
                           _render("_('Claim Name')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'state': {
                'header': [1, 20, 'text', _render("_('State')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and line.invoice_id.event_id.location_id and str(line.invoice_id.event_id.location_id.name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'date_of_loss': {
                'header': [1, 20, 'text',
                           _render("_('Date Of Loss')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'service_type': {
                'header': [1, 13, 'text',
                           _render("_('Service Type')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and line.invoice_id.event_id.event_type or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'service_language': {
                'header': [1, 20, 'text',
                           _render("_('Service Language')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.language_id and str(line.invoice_id.language_id.name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'language_interpretation_type': {
                'header':
                [1, 13, 'text',
                 _render("_('Language Interpretation Type')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and line.invoice_id.event_id.lang_service_type or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'urgent_or_nonurgent': {
                'header': [1, 30, 'text',
                           _render("_('Urgent or Nonurgent')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'referral_date': {
                'header': [1, 13, 'text',
                           _render("_('Referral Date')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.event_start_date) or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'referral_time': {
                'header': [1, 10, 'text',
                           _render("_('Referral Time')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id.event_id and str(line.invoice_id.event_id.event_start_hr or '') + ':' + str(line.invoice_id.event_id.event_start_min or '') + ' ' + str(line.invoice_id.event_id.am_pm or '') or '' "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'telephonic_confirmation_date': {
                'header':
                [1, 25, 'text',
                 _render("_('Telephonic Confirmation Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'email_confirm_date': {
                'header': [1, 10, 'text',
                           _render("_('Email Confirm Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claim_contact_date': {
                'header': [1, 10, 'text',
                           _render("_('Claim Contact Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claim_reconfirm_date': {
                'header':
                [1, 10, 'text',
                 _render("_('Claim Reconfirm Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claim_contact_date': {
                'header': [1, 10, 'text',
                           _render("_('Claim Contact Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'claim_reconfirm_date': {
                'header':
                [1, 10, 'text',
                 _render("_('Claim Reconfirm Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'no_show': {
                'header': [1, 13, 'text',
                           _render("_('No Show')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            #datetime.strptime(datetime.strptime(dt_from,"%Y-%m-%d").strftime('%Y-%m-%d %H:%M:%S'), "%Y-%m-%d %H:%M:%S")
            'cancellation': {
                'header': [1, 13, 'text',
                           _render("_('Cancellation')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'cancellation_reason': {
                'header': [1, 15, 'text',
                           _render("_('Cancellation Reason')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id and line.invoice_id.event_id and str(line.invoice_id.event_id.cancel_reason_id.name or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'date_of_cancellation': {
                'header':
                [1, 10, 'text',
                 _render("_('Date Of Cancellation')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'cancellation_notice': {
                'header': [1, 13, 'text',
                           _render("_('Cancellation Notice')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'date_summary_report_sent': {
                'header':
                [1, 10, 'text',
                 _render("_('Date Summary Report Sent')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'date_of_service': {
                'header': [
                    1, 10, 'text',
                    _render("_('Date Of Service')"), None,
                    self.rh_cell_style_right
                ],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'invoice_number': {
                'header': [1, 40, 'text',
                           _render("_('Invoice Number')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id and str(line.invoice_id.name or '')  or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'invoice_date': {
                'header': [1, 40, 'text',
                           _render("_('Invoice Date')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id and str(line.invoice_id.date_invoice or '') or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'invoice_submission_date': {
                'header':
                [1, 40, 'text',
                 _render("_('Invoice Submission Date')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'invoice_amount': {
                'header': [1, 40, 'text',
                           _render("_('Invoice Amount')")],
                'lines':
                [1, 0, 'number',
                 _render("line.price_subtotal  or ''")],
                'totals': [1, 0, 'text', None]
            },
            'cancellation_fee': {
                'header': [1, 40, 'text',
                           _render("_('Cancellation Fee')")],
                'lines': [1, 0, 'number', None],
                'totals': [1, 0, 'text', None]
            },
            'mileage': {
                'header': [1, 40, 'text',
                           _render("_('Mileage')")],
                'lines': [1, 0, 'number',
                          _render("line.mileage  or 0.0")],
                'totals': [1, 0, 'text', None]
            },
        }
    def __init__(self,
                 name,
                 table,
                 rml=False,
                 parser=False,
                 header=True,
                 store=False):
        super(account_invoice_xls_sales_commission,
              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 = {
            'id': {
                'header': [1, 10, 'text', _render("_('ID')")],
                'lines': [1, 0, 'number', _render("line.id  ")],
                'totals': [1, 0, 'text', None]
            },
            'invoice_number': {
                'header': [1, 15, 'text',
                           _render("_('Invoice Number')")],
                'lines': [1, 0, 'text',
                          _render("line.number or ''")],
                'totals': [1, 0, 'text', None]
            },
            'event_id': {
                'header': [1, 12, 'text',
                           _render("_('Event Name')")],
                'lines': [
                    1, 0, 'text',
                    _render("line.event_id and line.event_id.name or ''")
                ],
                'totals': [1, 0, 'text', None]
            },
            'outcome': {
                'header': [1, 12, 'text',
                           _render("_('Outcome')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'appt_month': {
                'header': [1, 10, 'text',
                           _render("_('Appointment Month')")],
                #                'lines': [1, 0, 'text',self._get_month(_render("line.event_start")), self.rt_cell_style_decimal],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'jurisdiction': {
                'header': [1, 10, 'text',
                           _render("_('Jurisdiction')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'text', None]
            },
            'language': {
                'header': [1, 15, 'text',
                           _render("_('Language')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.language_id and line.language_id.name or (line.event_id and line.event_id.language_id and line.event_id.language_id.name or '') "
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'transportation_type': {
                'header': [1, 10, 'text',
                           _render("_('Transportation Type')")],
                'lines': [1, 0, 'text', None],
                'totals': [1, 0, 'number', None, None]
            },
            'service_type': {
                'header': [1, 15, 'text',
                           _render("_('Service Type')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.invoice_id and line.invoice_id.event_id and line.invoice_id.event_id.event_type or ''"
                    )
                ],
                'totals': [1, 0, 'text', None]
            },
            'pay_location': {
                'header': [1, 15, 'text',
                           _render("_('Pay Location')")],
                'lines': [
                    1, 0, 'text',
                    _render(
                        "line.location_id and line.location_id.city or '' ")
                ],
                'totals': [1, 0, 'text', None]
            },
            'pay_company': {
                'header': [1, 15, 'text',
                           _render("_('Pay Company')")],
                'lines':
                [1, 0, 'text',
                 _render("line.partner_id.name or '' ")],
                'totals': [1, 0, 'text', None]
            },
            'amount': {
                'header': [
                    1, 10, 'text',
                    _render("_('Amount')"), None, self.rh_cell_style_right
                ],
                'lines': [
                    1, 0, 'number',
                    _render("line.residual and round(line.residual,2) or 0.0 ")
                ],
                'totals': [
                    1, 0, 'number', None,
                    _render("amount_total_formula"), self.rt_cell_style_decimal
                ]
            },
        }