frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register
Hello m'Managerians !
What do you think m'Manager 2.0 should be ? What features SHOULD or MUST be implemented right now ! Request or Vote here

adding amount paid to quote also

Hi any idea how i can add paid/deposit to quote ??

the attached images are from invoice, but i want that also at quote, any ideA?


thanks in advance !!

1.jpg 146.6K
2.jpg 155.6K

Comments

  • edited July 2017

    @AskinSavascisi
    Hi,
    I saw somewhere Purchase Order. This is a feature I will implement.
    What you try to do is cool, but the way you are doing can be confusing because Quotes become invoices when they are approved. They don't have Amount Paid or Transactions fields. So you will need lot of functions and javascript to achieve this.

    What you should do ?
    First, let's see how invoices work.
    1. You have a create_invoice/edit_invoice view files. These files post all its data to invoices/controllers/Ajax.php/create_invoice() function for create or update
    2. When all fields are ok, the script writes in oc_invoices table AND oc_invoiceitems
    3. When a transaction occurs, a third table is written, oc_transactions where all financial data are saved.

    So, to achieve your project.
    1. First duplicate create_invoice_form.php/edit_invoice_form.php view files and rename them to create_purchase_form.php/ edit_purchase_form.php
    2. Add a hidden field "is_purchase_order" in create_purchase/edit_purchase view files: <input type="hidden" name="is_purchase_order" value="1">
    2. Edit the create_invoice() function in the Ajax.php $invoiceTable['is_purchase_order'] => $this->input->post('is_purchase_order')
    3. Alter the oc_invoices table with this query ALTER TABLE oc_invoices ADD is_purchase_order tinyint(1) DEFAULT 0 4. In modules/invoices/Invoices.php duplicate the create_invoice() and edit this way public function create_purchase()
    {
    $data = array(
    'clients' => clients()
    );
    $this->view_data['content'] = $this->load->view('create_purchase_form', $data, true);
    $this->load->view('templates/layout', $this->view_data);
    } 5. Duplicate the edit() function and edit this line $this->view_data['content'] = $this->load->view('edit_invoice_form', $view_data, true); to $this->view_data['content'] = $this->load->view('edit_purchase_form', $view_data, true); 6. Open application/modules/templates/views/layout.php and add a link


    " class="nav-link nav-toggle">

    PURCHASE ORDER

    `
    Now, you get the invoice form for purchase order. This form will post in the same function as invoice, this way you don't need to edit core functions. Your 'is_purchase_order' will be used to query the same table with a where clause for invoices list.

    Let me know if you are ready for the last steps: display the purchases order :smiley:

  • I see that the code is not correctly rendered by the forum. Here is a text file

  • hi could you post the code to somewhere where i can see the RAW of it?? its quite confusing with those "red" / highlighting?

    and should i copy the files in the same folder? or make a folder for it?

  • @AskinSavascisi said:
    hi could you post the code to somewhere where i can see the RAW of it?? its quite confusing with those "red" / highlighting?

    and should i copy the files in the same folder? or make a folder for it?

    You have the code in the attachment edit.txt in one my comment. Yes copy in the same folder for add/edit and the same file for functions

  • thanks for thext file. where should i past the hidden field at the end of the file?

  • @AskinSavascisi said:
    thanks for thext file. where should i past the hidden field at the end of the file?

    Anywhere before the closing

  • edited July 2017

    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

  • @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

  • @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

  • @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

    Sorry, you should name it edit_purchase()

  • @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

    Sorry, you should name it edit_purchase()

    ok i'm ready for the second part :)

  • @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

    Sorry, you should name it edit_purchase()

    ok i'm ready for the second part :)

    Ready now now or have a rest and continue tomorrow ? ;)

  • @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

    Sorry, you should name it edit_purchase()

    ok i'm ready for the second part :)

    Ready now now or have a rest and continue tomorrow ? ;)

    did you have enough rest? :smiley:

  • @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

    Sorry, you should name it edit_purchase()

    ok i'm ready for the second part :)

    Ready now now or have a rest and continue tomorrow ? ;)

    did you have enough rest? :smiley:

    Lol, I was adding the file. We are synced !

  • @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:

    @Developer said:

    @AskinSavascisi said:
    Hey Eric,

    when I click on the purchase order on menu im getting a blank page? what did i do wrong? :/

    I'm also having a problem on invoice tab. i'm getting a blank page :disappointed:

    Available for teamviewer ?

    EDIT: it was the edit() function, i renamed it to editt() and it fixed the blank page.

    so i have now 2 edit() functions??

    Sorry, you should name it edit_purchase()

    ok i'm ready for the second part :)

    Ready now now or have a rest and continue tomorrow ? ;)

    did you have enough rest? :smiley:

    Do you see the attached file ? The forum is not well organized !

  • which js file was it for active menu tab?

  • @AskinSavascisi said:
    which js file was it for active menu tab?

    root/oc_contents/theme/scripts/mmanager/mmanager.js

  • @Developer said:
    I am working on the calendar

    super can't wait for that feature, thanks for the filepath btw :)

  • hi, we forgot to add this code to application/modules/invoices/controllers/invoices.php

    and which file was it again for invoice/purchase export template? e.g: invoice_tpl1 default for purchase and invoice_tpl3 for invoice

    public function edit_purchase()
    {
    $id = _dID($_REQUEST['id']);
    $view_data = array(
    'user_language' => get_option('user_language', 'users_options'),
    'invoices' => get_invoice_by_number($id),
    'invoice_items' => get_invoiced_items($id),
    'clients' => json_encode(clients()),
    'payment_fees' => null !== get_invoice_charges($id) ? get_invoice_charges($id) : floatval(0),
    'charges_sku' => null !== get_charges_sku($id) ? get_charges_sku($id) : generate_sku(),
    'invoice_status' => array(
    'Draft' => ucfirst(('option_draft')),
    'Unpaid' => ucfirst(
    ('option_unpaid')),
    'Paid' => ucfirst(('option_paid')),
    'Open' => ucfirst(
    ('label_opened')),
    'Paidout' => ucfirst(('label_paidout')),
    'Failed' => ucfirst(
    ('is_failed')),
    'Expired' => ucfirst(('label_expired')),
    'Refunded' => ucfirst(
    ('label_refunded')),
    'Pending' => ucfirst(('label_pending')),
    'Charged_back' => ucfirst(
    ('label_charged_back')),
    'Overdue' => ucfirst(('option_overdue')),
    'Cancelled' => ucfirst(
    ('option_cancelled'))
    ),
    'pay_type' => array(
    '1' => __('option_once'),
    '2' => __('option_weekly'),
    '3' => __('option_biweekly'),
    '4' => __('option_monthly'),
    '5' => __('option_yearly'),
    )
    );
    $this->view_data['content'] = $this->load->view('edit_purchase_form', $view_data, true);
    $this->load->view('templates/layout', $this->view_data);
    }

  • @AskinSavascisi said:
    hi, we forgot to add this code to application/modules/invoices/controllers/invoices.php

    and which file was it again for invoice/purchase export template? e.g: invoice_tpl1 default for purchase and invoice_tpl3 for invoice

    public function edit_purchase()
    {
    $id = _dID($_REQUEST['id']);
    $view_data = array(
    'user_language' => get_option('user_language', 'users_options'),
    'invoices' => get_invoice_by_number($id),
    'invoice_items' => get_invoiced_items($id),
    'clients' => json_encode(clients()),
    'payment_fees' => null !== get_invoice_charges($id) ? get_invoice_charges($id) : floatval(0),
    'charges_sku' => null !== get_charges_sku($id) ? get_charges_sku($id) : generate_sku(),
    'invoice_status' => array(
    'Draft' => ucfirst(('option_draft')),
    'Unpaid' => ucfirst(
    ('option_unpaid')),
    'Paid' => ucfirst(('option_paid')),
    'Open' => ucfirst(
    ('label_opened')),
    'Paidout' => ucfirst(('label_paidout')),
    'Failed' => ucfirst(
    ('is_failed')),
    'Expired' => ucfirst(('label_expired')),
    'Refunded' => ucfirst(
    ('label_refunded')),
    'Pending' => ucfirst(('label_pending')),
    'Charged_back' => ucfirst(
    ('label_charged_back')),
    'Overdue' => ucfirst(('option_overdue')),
    'Cancelled' => ucfirst(
    ('option_cancelled'))
    ),
    'pay_type' => array(
    '1' => __('option_once'),
    '2' => __('option_weekly'),
    '3' => __('option_biweekly'),
    '4' => __('option_monthly'),
    '5' => __('option_yearly'),
    )
    );
    $this->view_data['content'] = $this->load->view('edit_purchase_form', $view_data, true);
    $this->load->view('templates/layout', $this->view_data);
    }

    Hi, in the first step you duplicated the edit() method and renamed it to edit_purchase() Right ?
    Because invoices and quotes/purchase have to accessible, they are out of admin scope in application/controllers/Viewinvoice.php

  • @Developer said:

    @AskinSavascisi said:
    hi, we forgot to add this code to application/modules/invoices/controllers/invoices.php

    and which file was it again for invoice/purchase export template? e.g: invoice_tpl1 default for purchase and invoice_tpl3 for invoice

    public function edit_purchase()
    {
    $id = _dID($_REQUEST['id']);
    $view_data = array(
    'user_language' => get_option('user_language', 'users_options'),
    'invoices' => get_invoice_by_number($id),
    'invoice_items' => get_invoiced_items($id),
    'clients' => json_encode(clients()),
    'payment_fees' => null !== get_invoice_charges($id) ? get_invoice_charges($id) : floatval(0),
    'charges_sku' => null !== get_charges_sku($id) ? get_charges_sku($id) : generate_sku(),
    'invoice_status' => array(
    'Draft' => ucfirst(('option_draft')),
    'Unpaid' => ucfirst(
    ('option_unpaid')),
    'Paid' => ucfirst(('option_paid')),
    'Open' => ucfirst(
    ('label_opened')),
    'Paidout' => ucfirst(('label_paidout')),
    'Failed' => ucfirst(
    ('is_failed')),
    'Expired' => ucfirst(('label_expired')),
    'Refunded' => ucfirst(
    ('label_refunded')),
    'Pending' => ucfirst(('label_pending')),
    'Charged_back' => ucfirst(
    ('label_charged_back')),
    'Overdue' => ucfirst(('option_overdue')),
    'Cancelled' => ucfirst(
    ('option_cancelled'))
    ),
    'pay_type' => array(
    '1' => __('option_once'),
    '2' => __('option_weekly'),
    '3' => __('option_biweekly'),
    '4' => __('option_monthly'),
    '5' => __('option_yearly'),
    )
    );
    $this->view_data['content'] = $this->load->view('edit_purchase_form', $view_data, true);
    $this->load->view('templates/layout', $this->view_data);
    }

    Hi, in the first step you duplicated the edit() method and renamed it to edit_purchase() Right ?
    Because invoices and quotes/purchase have to accessible, they are out of admin scope in application/controllers/Viewinvoice.php

    yes, i duplicated and renamed it afterward

  • Which file was it for pdf export ? Lets say invoice_tpl1 only for purchase and tpl4 for invoice
  • @AskinSavascisi said:
    Which file was it for pdf export ? Lets say invoice_tpl1 only for purchase and tpl4 for invoice

    You should keep somewhere the app structure ;)
    Pdf view controllers are in application/controllers/Viewinvoice.php or Viewquote.php

  • null
    You're right im allready taking notes of files and path's :) thats why im asking xD
  • when adding a purchase order , it's also showing up under invoices tab, how to disable that?

  • Hi, if i give in a purchase order they are visible in purchase_index as it should be but also in invoice_index.

    how can i filter that?

  • Hi, you need a where clause in the get_invoices() method. `AND is_purchase_order = 0`
  • edited July 2017

    Another bug :

    The invoice/ purchase counter is the same.

    let's say if i make an invoice 1, and if I go to purchase order the count is 2, then go back to invoice its 3 :tired_face:

    and any idea if i can leave the accounter at a custom number? since IRL im at invoice 1043 or something :) and change from prefix to suffic? like 1043#2017

  • @AskinSavascisi said:
    Another bug :

    The invoice/ purchase counter is the same.

    let's say if i make an invoice 1, and if I go to purchase order the count is 2, then go back to invoice its 3 :tired_face:

    and any idea if i can leave the accounter at a custom number? since IRL im at invoice 1043 or something :) and change from prefix to suffic? like 1043#2017

    Hi, open application/librairies/M_manager.php and locate 'countOverdueInvoices' => (!count_invoices('Overdue')) ? '' : count_invoices('Overdue')
    add a new var 'countOverduePurchases' and locate the count_invoices function in functions_helper and add a where clause

Sign In or Register to comment.

m'Manager

| Let's Build Together a Great App !
If you are a happy user, send me a coffee.
2015 - 2107 © m'Manager.
Powered by VanillaForums, Designed by ThemeSteam

Recent Donations

  • Joni Mueller from https://pixelita.com/ - 63€
  • HeyrmanD from https://locco-palace.be - 25€
  • Patricia from Sjopz.com - 10€
  • AskinSavascisi from wolftech.com - 3€
  • Get In Touch