Author Topic: Billing  (Read 33973 times)

mencom

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Billing
« Reply #15 on: August 13, 2009, 05:48:34 pm »
Yes, but not only taxes. I believe invoice numbering and paper size is also conditioned by law sometimes.

Too bad, it would be great to have an invoice application in OpenGoo. I think that's the only thing that's really missing at the moment.


Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #16 on: August 13, 2009, 05:50:19 pm »
I agree.  I'm a bit confused at why, if there's a billing/invoice feature in place, it requires things that bamboo invoices doesn't even do. 

mrmango

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #17 on: November 10, 2009, 09:39:41 am »
Not looked at the data structure for either, but a data link between the two, should be fairly easy. I could write one and have it in Java, as a scheduled task.

Cheers

jpic

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #18 on: November 19, 2009, 03:36:40 pm »
Simple patch to make BambooInvoice use OpenGoo companies for contacts. Replace "og_" with your OpenGoo table names prefix.

Code: [Select]
diff --git a/bamboo_system_files/application/models/clients_model.php b/bamboo_system_files/application/models/clients_model.php
index fc6da08..939db6c 100755
--- a/bamboo_system_files/application/models/clients_model.php
+++ b/bamboo_system_files/application/models/clients_model.php
@@ -26,8 +26,32 @@ class clients_model extends Model {
 //                     $companies[$company->id] = $company->name;
 //             }
 
+        // goodified
+        return $this->db->query( '
+            select
+                ogc.id,
+                ogc.name,
+                ogc.address as address1,
+                ogc.address2 as address2,
+                ogc.city,
+                ogc.state as province,
+                ogc.zipcode as postal_code,
+                ogc.country as country,
+                ogc.homepage as website,
+                ogc.notes as client_notes,
+                ogts.value as tax_status,
+                ogtc.value as tax_code
+            from og_companies as ogc
+            left join (
+                    select * from og_object_properties where name="tax_status"
+                ) ogts on ogts.rel_object_id = ogc.id
+            left join (
+                    select * from og_object_properties where name="tax_code"
+                ) ogtc on ogtc.rel_object_id = ogc.id
+        ' );
+
+        // Originnal code
                $this->db->orderby('name', 'asc');
-
                return $this->db->get('clients');
        }
 
@@ -35,6 +59,30 @@ class clients_model extends Model {
 
        function get_client_info($id, $fields = '*')
        {
+        // goodified
+        return $this->db->query( '
+            select
+                ogc.id,
+                ogc.name,
+                ogc.address as address1,
+                ogc.address2 as address2,
+                ogc.city,
+                ogc.state as province,
+                ogc.zipcode as postal_code,
+                ogc.country as country,
+                ogc.homepage as website,
+                ogc.notes as client_notes,
+                ogts.value as tax_status,
+                ogtc.value as tax_code
+            from og_companies as ogc
+            left join (
+                    select * from og_object_properties where name="tax_status"
+                ) ogts on ogts.rel_object_id = ogc.id
+            left join (
+                    select * from og_object_properties where name="tax_code"
+                ) ogtc on ogtc.rel_object_id = ogc.id
+            where ogc.id = ' . intval( $id ) )->row(  );
+
                $this->db->select($fields);
                $this->db->where('id', $id);

Add "tax_code" and "tax_status" properties to OpenGoo company objects.
Then apply in bamboo invoice root with command `patch -P1 < /path/to/patch`
« Last Edit: November 19, 2009, 03:40:39 pm by jpic »

Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #19 on: November 19, 2009, 07:23:11 pm »
I appreciate the patch, but I think a lot of people do not use each entry as a company.

For instance, myself, I have a workspace called "Clients" with all of the subworkspaces for different clients, etc.  The clients workspace has all the contacts I have.

Each contact is not a company.  I think many people would not have every single contact as a different "company."  What could we do?

jpic

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #20 on: November 20, 2009, 06:17:28 am »
I appreciate the patch, but I think a lot of people do not use each entry as a company.
True for b2c, this version supports billing individuals as a company.

Each contact is not a company.  I think many people would not have every single contact as a different "company."  What could we do?
Actually i just did this as an exercise to evaluate BambooInvoice; we only do b2b so we never bill contacts although this version supports it.

http://pub.ocpsys.com/opengoo/bamboo_b2c/bamboo_system_files/application/models/clients_model.txt

But it looks better to consider a simple bridge design for b2b: OG companies for BI clients, and OG contacts for BI contacts.

Also, the SQL might break OpenGoo. So i'm unsure that we can have a unique in object_properties table with columns rel_object_id, rel_object_manager, name. Try it out on:
http://goo.ocpsys.com/ user: jpic pass: demo
http://boo.ocpsys.com/ user:demo@example.com pass: demo

For instance, myself, I have a workspace called "Clients" with all of the subworkspaces for different clients, etc.  The clients workspace has all the contacts I have.
In that case, joinning tables project_contacts and project_companies looks trivial to implement.
I'm running out of free time, i'll implement next time.

In any case, Capitan, thanks for your input. If you don't mind, please elaborate more next time.
« Last Edit: November 20, 2009, 07:08:42 am by jpic »

Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #21 on: November 20, 2009, 11:05:43 am »
Thanks!  I look forward to future versions that may support my type of setup so I can start using it.
I really hate having to create a duplicate entry for clients in bamboo after i created them already in opengoo.

jpic

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #22 on: November 20, 2009, 12:27:08 pm »
My bad, i wasn't very clear.

The first version posted as a patch inside the forum post on November 19 only supports OG companies to be used for BI clients.

The second version posted as a link in the forum post on November 20 supports using OG companies and clients for the BI clients. Additionnaly, it supports 2-way updating in a way that looks safe to me.

Feel free to try the second version online with the demo credentials provided, and report bugs or see if it fits your needs or not - it's open source.

Again, thanks Capitan for your help  8)

Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #23 on: November 22, 2009, 05:43:35 am »
Well, Im wondering if I should backup my opengoo db first;)

im a bit scared of the two way writing!

Is this the one I should use?

http://pub.ocpsys.com/opengoo/bamboo_b2c/bamboo_system_files/application/models/clients_model.txt

jpic

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #24 on: November 22, 2009, 07:50:31 am »
Derek Allard kindly uploaded BambooInvoice sources on github which makes it easier to hack the fork.

Writing on OpenGoo table can be disabled with version b2c0.1, feel free to consult the complete changelog.

Consider the full documentation on http://github.com/jpic/BambooInvoice/tree/b2c0.1.

Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #25 on: November 22, 2009, 01:37:31 pm »
I tried creating a new contact called mister client and put as his email, foo@ba2r.com.

It didn't copy his email over to bamboo.

Also, what will this do with existing clients/invoices in bamboo?   As in, as soon as I implement this patch, will I have duplicates because I had manually created the same people in bamboo before and invoices for them.

jpic

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #26 on: November 22, 2009, 02:06:35 pm »
Quote
I tried creating a new contact called mister client and put as his email, foo@ba2r.com.

Thanks for testing and giving feedback! I really appreciate.

About update OpenGoo company or contacts database, it is useful to set "tax class" and "tax code" from BI, so that might not be something you want to deactivate after all.

Quote
Also, what will this do with existing clients/invoices in bamboo?
It doesn't make any change in Bamboo database.

Quote
As in, as soon as I implement this patch, will I have duplicates because I had manually created the same people in bamboo before and invoices for them.
You will not see BI clients at all anymore, so there should be no duplicate. Relations between clients and invoices should be broken because "id" of OG companies/contacts is not the same as the "id" of BI clients. Don't worry, invoices is the objective of the next version.

Quote
It didn't copy his email over to bamboo.
There is no email field in BI clients... Only in BI clientcontact.

Where do you put client email in BI? (url)
How many BI clients and BI clientcontacts do you have approximately?
« Last Edit: November 22, 2009, 02:08:27 pm by jpic »

Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #27 on: November 22, 2009, 02:11:01 pm »
I click "add contact" in BI to add an email address, so I can email invoices to people.

What will happen to my existing invoice relationships when they are broken, then?  Do I need to wait till next version to properly assign them to the correct client?

thanks!

jpic

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Billing
« Reply #28 on: November 22, 2009, 02:17:31 pm »
I understand how to fix the invoice and email contact problem, for new clients.

How do you suggest to find the OpenGoo company or contact for existing BI clients? That's all i need to know then i can fix old relations ...

Capitan

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Billing
« Reply #29 on: November 22, 2009, 03:38:06 pm »
I really don't know short of some interactive option.   I don't think bamboo allows moving invoices to different clients?