Example #1
3
def make_payment_inv_add(user, make_payment, **kwargs):
    inv = Invoice()
    # field to be populated to invoice
    inv.title = "Make Payment Invoice"
    inv.bill_to =  make_payment.first_name + ' ' + make_payment.last_name
    inv.bill_to_first_name = make_payment.first_name
    inv.bill_to_last_name = make_payment.last_name
    inv.bill_to_company = make_payment.company
    inv.bill_to_address = '%s %s' % (make_payment.address,
                                     make_payment.address2)
    inv.bill_to_city = make_payment.city
    inv.bill_to_state =  make_payment.state
    inv.bill_to_zip_code = make_payment.zip_code
    inv.bill_to_country = make_payment.country
    inv.bill_to_phone = make_payment.phone
    inv.bill_to_email = make_payment.email
    inv.ship_to =  make_payment.first_name + ' ' + make_payment.last_name
    inv.ship_to_first_name = make_payment.first_name
    inv.ship_to_last_name = make_payment.last_name
    inv.ship_to_company = make_payment.company
    inv.ship_to_address = '%s %s' % (make_payment.address,
                                     make_payment.address2)
    inv.ship_to_city = make_payment.city
    inv.ship_to_state = make_payment.state
    inv.ship_to_zip_code =  make_payment.zip_code
    inv.ship_to_country = make_payment.country
    inv.ship_to_phone =  make_payment.phone
    inv.ship_to_email = make_payment.email
    inv.terms = "Due on Receipt"
    inv.due_date = datetime.now()
    inv.ship_date = datetime.now()
    inv.message = 'Thank You.'
    inv.status = True
    
    inv.estimate = True
    inv.status_detail = 'estimate'
    inv.object_type = ContentType.objects.get(app_label=make_payment._meta.app_label, model=make_payment._meta.module_name)
    inv.object_id = make_payment.id
    inv.subtotal = make_payment.payment_amount
    inv.total = make_payment.payment_amount
    inv.balance = make_payment.payment_amount
    
    if user and not user.is_anonymous():
        inv.set_creator(user)
        inv.set_owner(user)

    inv.save(user)
    # tender the invoice
    inv.tender(user)
    make_payment.invoice_id = inv.id
    
    return inv
Example #2
0
def make_payment_inv_add(user, make_payment, **kwargs):
    inv = Invoice()
    # field to be populated to invoice
    inv.title = _("Make Payment Invoice")
    inv.bill_to = make_payment.first_name + ' ' + make_payment.last_name
    inv.bill_to_first_name = make_payment.first_name
    inv.bill_to_last_name = make_payment.last_name
    inv.bill_to_company = make_payment.company
    inv.bill_to_address = '%s %s' % (make_payment.address,
                                     make_payment.address2)
    inv.bill_to_city = make_payment.city
    inv.bill_to_state = make_payment.state
    inv.bill_to_zip_code = make_payment.zip_code
    inv.bill_to_country = make_payment.country
    inv.bill_to_phone = make_payment.phone
    inv.bill_to_email = make_payment.email
    inv.ship_to = make_payment.first_name + ' ' + make_payment.last_name
    inv.ship_to_first_name = make_payment.first_name
    inv.ship_to_last_name = make_payment.last_name
    inv.ship_to_company = make_payment.company
    inv.ship_to_address = '%s %s' % (make_payment.address,
                                     make_payment.address2)
    inv.ship_to_city = make_payment.city or ''
    inv.ship_to_state = make_payment.state or ''
    inv.ship_to_zip_code = make_payment.zip_code or ''
    inv.ship_to_country = make_payment.country or ''
    inv.ship_to_phone = make_payment.phone or ''
    inv.ship_to_email = make_payment.email or ''
    inv.terms = "Due on Receipt"
    inv.due_date = datetime.now()
    inv.ship_date = datetime.now()
    inv.message = 'Thank You.'
    inv.status = True

    inv.estimate = True
    inv.status_detail = 'estimate'
    inv.object_type = ContentType.objects.get(
        app_label=make_payment._meta.app_label,
        model=make_payment._meta.model_name)
    inv.object_id = make_payment.id
    inv.subtotal = make_payment.payment_amount
    inv.total = make_payment.payment_amount
    inv.balance = make_payment.payment_amount

    if user and not user.is_anonymous:
        inv.set_creator(user)
        inv.set_owner(user)

    inv.save(user)
    # tender the invoice
    inv.tender(user)
    make_payment.invoice_id = inv.id

    return inv
Example #3
0
def donation_inv_add(user, donation, **kwargs):
    inv = Invoice()
    inv.title = "Donation Invoice"
    inv.bill_to = donation.first_name + ' ' + donation.last_name
    inv.bill_to_first_name = donation.first_name
    inv.bill_to_last_name = donation.last_name
    inv.bill_to_company = donation.company
    inv.bill_to_address = donation.address
    inv.bill_to_city = donation.city
    inv.bill_to_state = donation.state
    inv.bill_to_zip_code = donation.zip_code
    inv.bill_to_country = donation.country
    inv.bill_to_phone = donation.phone
    inv.bill_to_email = donation.email
    inv.ship_to = donation.first_name + ' ' + donation.last_name
    inv.ship_to_first_name = donation.first_name
    inv.ship_to_last_name = donation.last_name
    inv.ship_to_company = donation.company
    inv.ship_to_address = donation.address
    inv.ship_to_city = donation.city
    inv.ship_to_state = donation.state
    inv.ship_to_zip_code = donation.zip_code
    inv.ship_to_country = donation.country
    inv.ship_to_phone = donation.phone
    #self.ship_to_fax = make_payment.fax
    inv.ship_to_email = donation.email
    inv.terms = "Due on Receipt"
    inv.due_date = datetime.now()
    inv.ship_date = datetime.now()
    inv.message = 'Thank You.'
    inv.status = True

    if donation.donate_to_entity:
        inv.entity = donation.donate_to_entity

    inv.estimate = True
    inv.status_detail = 'tendered'
    inv.object_type = ContentType.objects.get(
        app_label=donation._meta.app_label, model=donation._meta.model_name)
    inv.object_id = donation.id
    inv.subtotal = donation.donation_amount
    inv.total = donation.donation_amount
    inv.balance = donation.donation_amount

    inv.save(user)
    donation.invoice = inv

    return inv
Example #4
0
def make_payment_inv_add(user, make_payment, **kwargs):
    inv = Invoice()
    # field to be populated to invoice
    inv.title = "Make Payment Invoice"
    inv.bill_to = make_payment.first_name + ' ' + make_payment.last_name
    inv.bill_to_first_name = make_payment.first_name
    inv.bill_to_last_name = make_payment.last_name
    inv.bill_to_company = make_payment.company
    inv.bill_to_address = make_payment.address
    inv.bill_to_city = make_payment.city
    inv.bill_to_state = make_payment.state
    inv.bill_to_zip_code = make_payment.zip_code
    inv.bill_to_country = make_payment.country
    inv.bill_to_phone = make_payment.phone
    inv.bill_to_email = make_payment.email
    inv.ship_to = make_payment.first_name + ' ' + make_payment.last_name
    inv.ship_to_first_name = make_payment.first_name
    inv.ship_to_last_name = make_payment.last_name
    inv.ship_to_company = make_payment.company
    inv.ship_to_address = make_payment.address
    inv.ship_to_city = make_payment.city
    inv.ship_to_state = make_payment.state
    inv.ship_to_zip_code = make_payment.zip_code
    inv.ship_to_country = make_payment.country
    inv.ship_to_phone = make_payment.phone
    inv.ship_to_email = make_payment.email
    inv.terms = "Due on Receipt"
    inv.due_date = datetime.now()
    inv.ship_date = datetime.now()
    inv.message = 'Thank You.'
    inv.status = True

    inv.estimate = True
    inv.status_detail = 'tendered'
    inv.object_type = ContentType.objects.get(
        app_label=make_payment._meta.app_label,
        model=make_payment._meta.module_name)
    inv.object_id = make_payment.id
    inv.subtotal = make_payment.payment_amount
    inv.total = make_payment.payment_amount
    inv.balance = make_payment.payment_amount

    inv.save(user)
    make_payment.invoice_id = inv.id

    return inv
Example #5
0
def donation_inv_add(user, donation, **kwargs):
    inv = Invoice()
    inv.title = "Donation Invoice"
    inv.bill_to = donation.first_name + ' ' + donation.last_name
    inv.bill_to_first_name = donation.first_name
    inv.bill_to_last_name = donation.last_name
    inv.bill_to_company = donation.company
    inv.bill_to_address = donation.address
    inv.bill_to_city = donation.city
    inv.bill_to_state = donation.state
    inv.bill_to_zip_code = donation.zip_code
    inv.bill_to_country = donation.country
    inv.bill_to_phone = donation.phone
    inv.bill_to_email = donation.email
    inv.ship_to = donation.first_name + ' ' + donation.last_name
    inv.ship_to_first_name = donation.first_name
    inv.ship_to_last_name = donation.last_name
    inv.ship_to_company = donation.company
    inv.ship_to_address = donation.address
    inv.ship_to_city = donation.city
    inv.ship_to_state = donation.state
    inv.ship_to_zip_code = donation.zip_code
    inv.ship_to_country = donation.country
    inv.ship_to_phone = donation.phone
    #self.ship_to_fax = make_payment.fax
    inv.ship_to_email =donation.email
    inv.terms = "Due on Receipt"
    inv.due_date = datetime.now()
    inv.ship_date = datetime.now()
    inv.message = 'Thank You.'
    inv.status = True

    inv.estimate = True
    inv.status_detail = 'tendered'
    inv.object_type = ContentType.objects.get(app_label=donation._meta.app_label,
                                              model=donation._meta.model_name)
    inv.object_id = donation.id
    inv.subtotal = donation.donation_amount
    inv.total = donation.donation_amount
    inv.balance = donation.donation_amount

    inv.save(user)
    donation.invoice = inv

    return inv
Example #6
0
def job_set_inv_payment(user, job, pricing):
    if get_setting('module', 'jobs', 'jobsrequirespayment'):
        if not job.invoice:
            inv = Invoice()
            inv.object_type = ContentType.objects.get(
                app_label=job._meta.app_label, model=job._meta.module_name)
            inv.object_id = job.id
            inv.title = "Job Add Invoice"
            inv.bill_to = job.contact_name
            first_name = ''
            last_name = ''
            if job.contact_name:
                name_list = job.contact_name.split(' ')
                if len(name_list) >= 2:
                    first_name = name_list[0]
                    last_name = ' '.join(name_list[1:])
            inv.bill_to_first_name = first_name
            inv.bill_to_last_name = last_name
            inv.bill_to_company = job.contact_company
            inv.bill_to_address = job.contact_address
            inv.bill_to_city = job.contact_city
            inv.bill_to_state = job.contact_state
            inv.bill_to_zip_code = job.contact_zip_code
            inv.bill_to_country = job.contact_country
            inv.bill_to_phone = job.contact_phone
            inv.bill_to_fax = job.contact_fax
            inv.bill_to_email = job.contact_email
            inv.ship_to = job.contact_name
            inv.ship_to_first_name = first_name
            inv.ship_to_last_name = last_name
            inv.ship_to_company = job.contact_company
            inv.ship_to_address = job.contact_address
            inv.ship_to_city = job.contact_city
            inv.ship_to_state = job.contact_state
            inv.ship_to_zip_code = job.contact_zip_code
            inv.ship_to_country = job.contact_country
            inv.ship_to_phone = job.contact_phone
            inv.ship_to_fax = job.contact_fax
            inv.ship_to_email = job.contact_email
            inv.terms = "Due on Receipt"
            inv.due_date = datetime.now()
            inv.ship_date = datetime.now()
            inv.message = 'Thank You.'
            inv.status = True

            inv.total = get_job_price(user, job, pricing)
            inv.subtotal = inv.total
            inv.balance = inv.total
            inv.estimate = 1
            inv.status_detail = 'estimate'
            inv.save(user)

            # tender the invoice
            inv.tender(user)

            # update job
            job.invoice = inv
            job.save()

            if user.profile.is_superuser:
                if job.payment_method in [
                        'paid - cc', 'paid - check', 'paid - wire transfer'
                ]:
                    boo_inv = inv.tender(user)

                    # payment
                    payment = Payment()
                    boo = payment.payments_pop_by_invoice_user(
                        user, inv, inv.guid)
                    payment.mark_as_paid()
                    payment.method = job.payment_method
                    payment.save(user)

                    # this will make accounting entry
                    inv.make_payment(user, payment.amount)
Example #7
0
def directory_set_inv_payment(user, directory, pricing):
    if get_setting('module', 'directories', 'directoriesrequirespayment'):
        if not directory.invoice:
            inv = Invoice()
            inv.object_type = ContentType.objects.get(
                app_label=directory._meta.app_label,
                model=directory._meta.module_name)
            inv.object_id = directory.id
            profile = user.get_profile()
            inv.title = "Directory Add Invoice"
            inv.bill_to = '%s %s' % (user.first_name, user.last_name)
            inv.bill_to_first_name = user.first_name
            inv.bill_to_last_name = user.last_name
            inv.bill_to_company = profile.company
            inv.bill_to_address = profile.address
            inv.bill_to_city = profile.city
            inv.bill_to_state = profile.state
            inv.bill_to_zip_code = profile.zipcode
            inv.bill_to_country = profile.country
            inv.bill_to_phone = profile.phone
            inv.bill_to_fax = profile.fax
            inv.bill_to_email = user.email
            inv.ship_to = inv.bill_to
            inv.ship_to_first_name = user.first_name
            inv.ship_to_last_name = user.last_name
            inv.ship_to_company = profile.company
            inv.ship_to_address = profile.address
            inv.ship_to_city = profile.city
            inv.ship_to_state = profile.state
            inv.ship_to_zip_code = profile.zipcode
            inv.ship_to_country = profile.country
            inv.ship_to_phone = profile.phone
            inv.ship_to_fax = profile.fax
            inv.ship_to_email = user.email
            inv.terms = "Due on Receipt"
            inv.due_date = datetime.now()
            inv.ship_date = datetime.now()
            inv.message = 'Thank You.'
            inv.status = True

            inv.total = get_directory_price(user, directory, pricing)
            inv.subtotal = inv.total
            inv.balance = inv.total
            inv.estimate = True
            inv.status_detail = 'estimate'

            if user and not user.is_anonymous():
                inv.set_creator(user)
                inv.set_owner(user)

            inv.save(user)

            # tender the invoice
            inv.tender(user)

            # update job
            directory.invoice = inv
            directory.save()

            if user.profile.is_superuser:
                if directory.payment_method in [
                        'paid - cc', 'paid - check', 'paid - wire transfer'
                ]:
                    boo_inv = inv.tender(user)

                    # payment
                    payment = Payment()
                    boo = payment.payments_pop_by_invoice_user(
                        user, inv, inv.guid)
                    payment.mark_as_paid()
                    payment.method = directory.payment_method
                    payment.save(user)

                    # this will make accounting entry
                    inv.make_payment(user, payment.amount)
Example #8
0
def directory_set_inv_payment(user, directory, pricing):
    if get_setting('module', 'directories', 'directoriesrequirespayment'):
        if not directory.invoice:
            inv = Invoice()
            inv.object_type = ContentType.objects.get(app_label=directory._meta.app_label,
                                              model=directory._meta.model_name)
            inv.object_id = directory.id
            profile = user.profile
            inv.title = "Directory Add Invoice"
            inv.bill_to = '%s %s' % (user.first_name, user.last_name)
            inv.bill_to_first_name = user.first_name
            inv.bill_to_last_name = user.last_name
            inv.bill_to_company = profile.company
            inv.bill_to_address = profile.address
            inv.bill_to_city = profile.city
            inv.bill_to_state = profile.state
            inv.bill_to_zip_code = profile.zipcode
            inv.bill_to_country = profile.country
            inv.bill_to_phone = profile.phone
            inv.bill_to_fax = profile.fax
            inv.bill_to_email = user.email
            inv.ship_to = inv.bill_to
            inv.ship_to_first_name = user.first_name
            inv.ship_to_last_name = user.last_name
            inv.ship_to_company = profile.company
            inv.ship_to_address = profile.address
            inv.ship_to_city = profile.city
            inv.ship_to_state = profile.state
            inv.ship_to_zip_code = profile.zipcode
            inv.ship_to_country = profile.country
            inv.ship_to_phone = profile.phone
            inv.ship_to_fax = profile.fax
            inv.ship_to_email = user.email
            inv.terms = "Due on Receipt"
            inv.due_date = datetime.now()
            inv.ship_date = datetime.now()
            inv.message = 'Thank You.'
            inv.status = True

            inv.total = get_directory_price(user, directory, pricing)
            inv.subtotal = inv.total
            inv.balance = inv.total
            inv.estimate = True
            inv.status_detail = 'estimate'

            if user and not user.is_anonymous():
                inv.set_creator(user)
                inv.set_owner(user)

            inv.save(user)

            # tender the invoice
            inv.tender(user)

            # update job
            directory.invoice = inv
            directory.save()

            if user.profile.is_superuser:
                if directory.payment_method in ['paid - cc', 'paid - check', 'paid - wire transfer']:
                    boo_inv = inv.tender(user)

                    # payment
                    payment = Payment()
                    boo = payment.payments_pop_by_invoice_user(user, inv, inv.guid)
                    payment.mark_as_paid()
                    payment.method = directory.payment_method
                    payment.save(user)

                    # this will make accounting entry
                    inv.make_payment(user, payment.amount)
Example #9
0
def job_set_inv_payment(user, job, pricing):
    if get_setting('module', 'jobs', 'jobsrequirespayment'):
        if not job.invoice:
            inv = Invoice()
            inv.object_type = ContentType.objects.get(app_label=job._meta.app_label, 
                                              model=job._meta.module_name)
            inv.object_id = job.id
            inv.title = "Job Add Invoice"
            inv.bill_to = job.contact_name
            first_name = ''
            last_name = ''
            if job.contact_name:
                name_list = job.contact_name.split(' ')
                if len(name_list) >= 2:
                    first_name = name_list[0]
                    last_name = ' '.join(name_list[1:])
            inv.bill_to_first_name = first_name
            inv.bill_to_last_name = last_name
            inv.bill_to_company = job.contact_company
            inv.bill_to_address = job.contact_address
            inv.bill_to_city = job.contact_city
            inv.bill_to_state = job.contact_state
            inv.bill_to_zip_code = job.contact_zip_code
            inv.bill_to_country = job.contact_country
            inv.bill_to_phone = job.contact_phone
            inv.bill_to_fax = job.contact_fax
            inv.bill_to_email = job.contact_email
            inv.ship_to = job.contact_name
            inv.ship_to_first_name = first_name
            inv.ship_to_last_name = last_name
            inv.ship_to_company = job.contact_company
            inv.ship_to_address = job.contact_address
            inv.ship_to_city = job.contact_city
            inv.ship_to_state = job.contact_state
            inv.ship_to_zip_code = job.contact_zip_code
            inv.ship_to_country = job.contact_country
            inv.ship_to_phone = job.contact_phone
            inv.ship_to_fax = job.contact_fax
            inv.ship_to_email =job.contact_email
            inv.terms = "Due on Receipt"
            inv.due_date = datetime.now()
            inv.ship_date = datetime.now()
            inv.message = 'Thank You.'
            inv.status = True
            
            inv.total = get_job_price(user, job, pricing)
            inv.subtotal = inv.total
            inv.balance = inv.total
            inv.estimate = 1
            inv.status_detail = 'estimate'
            
            if user and not user.is_anonymous():
                inv.set_creator(user)
                inv.set_owner(user)
            
            inv.save(user)

            # tender the invoice
            inv.tender(user)

            # update job
            job.invoice = inv
            job.save()
            
            if user.profile.is_superuser:
                if job.payment_method in ['paid - cc', 'paid - check', 'paid - wire transfer']:
                    boo_inv = inv.tender(user) 
                    
                    # payment
                    payment = Payment()
                    boo = payment.payments_pop_by_invoice_user(user, inv, inv.guid)
                    payment.mark_as_paid()
                    payment.method = job.payment_method
                    payment.save(user)
                    
                    # this will make accounting entry
                    inv.make_payment(user, payment.amount)