View Full Version : Billing Codes
I have searched the forums but have been unable to find must information on Billing Codes. I have entered 20 plus billing codes for one company and wish to use them for all the companies entered in DP. Is there a way to copy the codes from one company to another ?
Hi,
I think this billing codes way of working in task logs is incorrect.
I explain:
1) You only have access in task logs to the billing codes of that specific company.
2) What about generic billing codes, i mean the ones without a company defined (they are defined with company_id=0)?
3) This should be available for all task logs, i think.
Solution:
Change file modules/tasks/vw_log_update.php line 45 from:
$q->addWhere("company_id='$proj->project_company'");
to
$q->addWhere("company_id='$proj->project_company'"." OR company_id='0'");
Now once this has been done your problem is easy to solve, just change the company_id of those billing codes to 0 and your off to using the billing codes wherever you want for task logs, if your problem are the task logs, I assume it is your problem, right?
Pedro A.
Pedro,
I do not have the line you mentioned in the vw_log_update (version 1.29, 2005/03/14. I do have the following code.
$sql = "SELECT billingcode_id, billingcode_name
FROM billingcode
WHERE billingcode_status=0
AND company_id='$proj->project_company'
ORDER BY billingcode_name";
If I changed the AND company_id='$proj->project_company' to AND ("company_id='$proj->project_company'.'OR company_id='0'") would it work ?
Mike
Sorry, I am constantly updating with some CVS files and Gregor already changed this file.
Here goes to you:
$sql = "SELECT billingcode_id, billingcode_name
FROM billingcode
WHERE billingcode_status=0
AND (company_id='$proj->project_company' OR company_id=0)
ORDER BY billingcode_name";
Pedro A.
Pedro,
I made the change and it runs error free. I do have one last question that I hope you can answer. In you first response to me you said to change the company_id to 0. How would I do that ? I do not have access to the box that hosts MySql and I cannot seem to see where that change could be done within DP.
You are correct in your statement about using the billing codes in the task Logs. Be able to use the same billing code for each company would be great.
Thanks
Mike
Please if you don't understand the stuff i'll say, don't try it...
(After that major advice here goes trouble)
If you place before that code a line like:
db_exec("UPDATE billingcode SET company_id=0;");
This will be executed whenever you call the task log add or edit a task log. This would pull all your billingcodes into generic billingcodes that with the change we made are acessible to all task logs.
Attention this will pull all of the billingcodes to go to company_id=0 (beware if you really want to do this, it will be permanent) if you want just the ones from company 1:
db_exec("UPDATE billingcode SET company_id=0 WHERE company_id=1;"
Remove the line afterwards or it will keep executing and will not let you have specific company billingcodes, ok?
What's the visual feedback?
If you go to System admin., billing codes, you will see the companies will have no longer the specific billingcodes and they are now without company (the first option will have them all).
I recommend you install phpmyadmin, it will give you other resources for you to play around instead of doing things the way i said. would be as simple as go to the SQL pane and put UPDATE billingcode SET company_id=0; and see the results in the table, if it was not right you could edit the specific lines you wanted to change.
Pedro A.
Pedro,
Works fantastic.. In my situation the codes will always be the same so this fix takes care of this issue for me.
Thanks so much for all you help on this issue and the others you have resolved for me.
Mike
flycast
24-02-06, 01:30 PM
Pedro:
Thanks for your work. THis mod works well. I agree that this is the way it should be.
Eric
MacOfTheEast
01-04-06, 08:12 AM
Solution:
Change file modules/tasks/vw_log_update.php line 45 from:
$q->addWhere("company_id='$proj->project_company'");
to
$q->addWhere("company_id='$proj->project_company'"." OR company_id='0'");
You may correct me if I'm wrong, Pedro, but after making the above modification =AND= if you want the INVOICE module to also enjoy the benefit of this mod (and actually be able to "see" billing codes who's company_id = 0) there are three files in /modules/invoice that will also have to be changed. That would be, change this...
$q->addWhere('company_id = ' . $company_id);
to this...
$q->addWhere('company_id >=0');
in addedit.php, view.php, and vw_inc.php
True story?
MOTE
cyberhorse
02-04-06, 03:34 PM
seems so, except the where should be set to:
<php>
'(company_id = 0 OR company_id = ' . $company_id . ')'
</php>
This is already done and will be released in next version of invoice module (in a couple of weeks or so).
MacOfTheEast
03-04-06, 12:21 AM
seems so, except the where should be set to:
<php>
'(company_id = 0 OR company_id = ' . $company_id . ')'
</php>Thank you, Sir. However on my system your approach threw a T_CONSTANT error. I had to use this construct...
$q->addWhere('company_id = 0 OR company_id = ' . $company_id);
Sorry MOTE but I don't use the invoice module in such depth, so I'll just take your word for it.
Pedro A.
cyberhorse
03-04-06, 11:52 PM
you need the brackets around the whole thing, otherwise it will give you false positives
Cyberhorse, not sure if this is the right place to post but I have some comments on Billing Codes:
Shouldn't billing codes:
- Be located as a tab under Project or Company
(I guess the current relationship is to company, although it could be by company:project)
- Dollar costs be editable so I can update $ costs
(I realize this impacts past work completed/costs but one could do this at end of a month after invoices have gone out)
- On Finish save a new billing code, why recycle the window and lose the current company worked on? If I'm adding several billing codes, this is challenging as I have to go back over and over to reselect same Company
Hope these comments are useful to you, let me know if you want any more beta testing.
cyberhorse
28-04-06, 01:15 PM
These suggestions sound quite reasonable, please log them as feature requests in mantis and we'll get to them one day :)
(mantis is the bug tracking software we use - top left on the main dotproject.net site)
vBulletin® v3.6.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.