def footer_gen(organization):
    try:
        end = organization.address.all()[0]
        #line1 = "%s %s, %s - %s - %s - %s - %s" % (end.addressPrefix, end.addressLine1, end.addressNumber, end.addressLine2, end.neighborhood, first_capitalized(end.city.name), end.city.state.shortName)
        line1 = "%s %s, %s" % (
            end.addressPrefix, end.addressLine1, end.addressNumber)
        if len(end.addressLine2):
            line1 += " - %s" % end.addressLine2
        if len(end.neighborhood):
            line1 += " - %s" % end.neighborhood
        line1 += " - %s - %s" % (first_capitalized(end.city.name),
                                 end.city.state.shortName)
        line2 = "%s | %s | %s" % (organization.phones.all()[0], organization.sites.all()[
                                  0], organization.emails.all()[0])
        line3 = "CNPJ: %s | CNES: %s" % (
            organization.register_number, organization.cnes)

        class Footer(ReportBand):
            height = 0.5 * cm
            borders = {'top': True}
            default_style = {'fontName': 'Helvetica',
                             'fontSize': 8, 'alignment': TA_CENTER}
            elements = [
                SystemField(expression=u'%s' %
                            line1, top=0.1 * cm, width=BAND_WIDTH),
                SystemField(expression=u'%s' %
                            line2, top=0.4 * cm, width=BAND_WIDTH),
                SystemField(expression=u'%s' % line3, top=0.7 * cm, width=BAND_WIDTH), ]
    except:
        class Footer(ReportBand):
            height = 0.5 * cm
            borders = {'top': True}

    return Footer()
Example #2
0
 def get_address(self):
     text = ""
     if self.address.all().count():
         addr = self.address.all()[0]
         text = "%s %s, %s" % (addr.addressPrefix, addr.addressLine1, addr.addressNumber)
         if len(addr.addressLine2): text += " - %s" % addr.addressLine2
         if len(addr.neighborhood): text += " - %s" % addr.neighborhood
         text += "<br />%s - %s - %s" % (first_capitalized(addr.city.name), addr.city.state.shortName, addr.city.state.country.name)
         if len(addr.zipCode): text += " - CEP: %s" % addr.zipCode
     return text
Example #3
0
 def get_address(self):
     text = ""
     if self.address.all().count():
         addr = self.address.all()[0]
         text = "%s %s, %s" % (addr.addressPrefix, addr.addressLine1,
                               addr.addressNumber)
         if len(addr.addressLine2): text += " - %s" % addr.addressLine2
         if len(addr.neighborhood): text += " - %s" % addr.neighborhood
         text += "<br />%s - %s - %s" % (first_capitalized(
             addr.city.name), addr.city.state.shortName,
                                         addr.city.state.country.name)
         if len(addr.zipCode): text += " - CEP: %s" % addr.zipCode
     return text
Example #4
0
 def get_first_address(self):
     text = ""
     if self.address.all().count():
         addr = self.address.all()[0]
         text = "%s %s, %s" % (addr.addressPrefix, addr.addressLine1, addr.addressNumber)
         
         city = first_capitalized(addr.city.name) if hasattr(addr, "city") and addr.city else ""
         state = addr.city.state.shortName if hasattr(addr, "city") and hasattr(addr.city, "state") and addr.city.state else ""
         country = addr.city.state.country.name if hasattr(addr, "city") and hasattr(addr.city, "state") and hasattr(addr.city.state, "country") and addr.city.state.country  else ""
         
         if len(addr.addressLine2): text += " - %s" % addr.addressLine2
         if len(addr.neighborhood): text += " - %s" % addr.neighborhood
         text += "<br />%s - %s - %s" % (city, state, country)
         if len(addr.zipCode): text += " - CEP: %s" % addr.zipCode
     return text
Example #5
0
    def get_first_address(self):
        text = ""
        if self.address.all().count():
            addr = self.address.all()[0]
            text = "%s %s, %s" % (addr.addressPrefix, addr.addressLine1, addr.addressNumber)

            city = first_capitalized(addr.city.name) if hasattr(addr, "city") and addr.city else ""
            state = addr.city.state.shortName if hasattr(addr, "city") and hasattr(addr.city, "state") and addr.city.state else ""
            country = addr.city.state.country.name if hasattr(addr, "city") and hasattr(addr.city, "state") and hasattr(addr.city.state, "country") and addr.city.state.country  else ""

            if len(addr.addressLine2): text += " - %s" % addr.addressLine2
            if len(addr.neighborhood): text += " - %s" % addr.neighborhood
            text += "<br />%s - %s - %s" % (city, state, country)
            if len(addr.zipCode): text += " - CEP: %s" % addr.zipCode
        return text
Example #6
0
def footer_gen(organization):
    try:
        end = organization.address.all()[0]
        #line1 = "%s %s, %s - %s - %s - %s - %s" % (end.addressPrefix, end.addressLine1, end.addressNumber, end.addressLine2, end.neighborhood, first_capitalized(end.city.name), end.city.state.shortName)
        line1 = "%s %s, %s" % (end.addressPrefix, end.addressLine1,
                               end.addressNumber)
        if len(end.addressLine2):
            line1 += " - %s" % end.addressLine2
        if len(end.neighborhood):
            line1 += " - %s" % end.neighborhood
        line1 += " - %s - %s" % (first_capitalized(
            end.city.name), end.city.state.shortName)
        line2 = "%s | %s | %s" % (organization.phones.all()[0],
                                  organization.sites.all()[0],
                                  organization.emails.all()[0])
        line3 = "CNPJ: %s | CNES: %s" % (organization.register_number,
                                         organization.cnes)

        class Footer(ReportBand):
            height = 0.5 * cm
            borders = {'top': True}
            default_style = {
                'fontName': 'Helvetica',
                'fontSize': 8,
                'alignment': TA_CENTER
            }
            elements = [
                SystemField(expression=u'%s' % line1,
                            top=0.1 * cm,
                            width=BAND_WIDTH),
                SystemField(expression=u'%s' % line2,
                            top=0.4 * cm,
                            width=BAND_WIDTH),
                SystemField(expression=u'%s' % line3,
                            top=0.7 * cm,
                            width=BAND_WIDTH),
            ]
    except:

        class Footer(ReportBand):
            height = 0.5 * cm
            borders = {'top': True}

    return Footer()
Example #7
0
 def get_birth_place(self):
     if self.birthPlace == None:
         return u"%s - %s" % (self.birthForeignCity, self.birthForeignState)
     else:
         return u"%s - %s" % (first_capitalized(self.birthPlace.name), self.birthPlace.state.shortName)
Example #8
0
 def get_birth_place(self):
     if self.birthPlace == None:
         return u"%s - %s" % (self.birthForeignCity, self.birthForeignState)
     else:
         return u"%s - %s" % (first_capitalized(
             self.birthPlace.name), self.birthPlace.state.shortName)