コード例 #1
0
ファイル: create_invoice.php プロジェクト: sQcrm/sqcrm
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* Create invoice from sales order 
* @author Abhik Chakraborty
*/
$do_crmfields = new CRMFields();
$do_block = new Block();
$do_block->get_block_by_module(15);
//-- get block information for invoice
$do_global_settings = new CRMGlobalSettings();
$inv_terms_cond = $do_global_settings->get_inventory_terms_condition();
$tems_condition = $inv_terms_cond["invoice_terms_condition"];
$module_obj = new SalesOrder();
$module_obj->getId($sqcrm_record_id);
//-- get lineitems for sales order
$do_lineitems = new Lineitems();
$do_lineitems->get_line_items(14, $sqcrm_record_id);
//update the properties
$module_obj->terms_condition = $tems_condition;
$module_obj->inv_billing_address = $module_obj->so_billing_address;
$module_obj->inv_shipping_address = $module_obj->so_shipping_address;
$module_obj->inv_billing_po_box = $module_obj->so_billing_po_box;
$module_obj->inv_shipping_po_box = $module_obj->so_shipping_po_box;
$module_obj->inv_billing_po_code = $module_obj->so_billing_po_code;
$module_obj->inv_shipping_po_code = $module_obj->so_shipping_po_code;
$module_obj->inv_billing_city = $module_obj->so_billing_city;
$module_obj->inv_shipping_city = $module_obj->so_shipping_city;
$module_obj->inv_billing_state = $module_obj->so_billing_state;
$module_obj->inv_shipping_state = $module_obj->so_shipping_state;
コード例 #2
0
ファイル: edit.php プロジェクト: sQcrm/sqcrm
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* SalesOrder edit 
* @author Abhik Chakraborty
*/
$do_crmfields = new CRMFields();
$do_block = new Block();
$do_block->get_block_by_module($module_id);
$do_global_settings = new CRMGlobalSettings();
$inv_terms_cond = $do_global_settings->get_inventory_terms_condition();
$tems_condition = $inv_terms_cond["salesorder_terms_condition"];
$module_obj = new SalesOrder();
$module_obj->getId($sqcrm_record_id);
$do_lineitems = new Lineitems();
$do_lineitems->get_line_items($module_id, $sqcrm_record_id);
$do_products = new Products();
$lineitems = array();
if ($do_lineitems->getNumRows() > 0) {
    while ($do_lineitems->next()) {
        $product_available_tax = '';
        if ($do_lineitems->item_type == 'product') {
            $product_available_tax = $do_products->get_products_tax($do_lineitems->item_value);
        }
        $lineitems[] = array("idlineitems" => $do_lineitems->idlineitems, "item_type" => $do_lineitems->item_type, "item_name" => $do_lineitems->item_name, "item_value" => $do_lineitems->item_value, "item_description" => $do_lineitems->item_description, "item_quantity" => $do_lineitems->item_quantity, "item_price" => $do_lineitems->item_price, "discount_type" => $do_lineitems->discount_type, "discount_value" => $do_lineitems->discount_value, "discounted_amount" => $do_lineitems->discounted_amount, "tax_values" => $do_lineitems->tax_values, "product_available_tax" => $product_available_tax, "taxed_amount" => $do_lineitems->taxed_amount, "total_after_discount" => $do_lineitems->total_after_discount, "total_after_tax" => $do_lineitems->total_after_tax, "net_total" => $do_lineitems->net_total);
    }
}
//print_r($lineitems);
if (isset($_GET["return_page"]) && $_GET["return_page"] != '') {
    $return = $_GET["return_page"];
コード例 #3
0
    /**
     * function to export list data as PDF
     * @param string $file_name
     * @param array $fields_info
     * @param integer $module_id
     * Library used for PDF generation is tcpdf http://www.tcpdf.org/
     * @see http://www.tcpdf.org/performances.php
     */
    public function export_detail_data_pdf($module, $module_id, $record_id)
    {
        $do_crmfields = new CRMFields();
        $do_block = new Block();
        $do_block->get_block_by_module($module_id);
        $module_obj = new $module();
        $module_obj->getId($record_id);
        if ($module_obj->getNumRows() > 0) {
            $do_crmfields = new CRMFields();
            include_once THIRD_PARTY_LIB_PATH . "/mpdf/mpdf.php";
            $pdf = new mPDF();
            $do_crm_entity = new CRMEntity();
            $entity_identity = $do_crm_entity->get_entity_identifier($record_id, $module, $module_obj);
            $html = '';
            $html .= '<div style="float:left"><h3>' . $entity_identity . '</h3></div><div style="clear:both;"></div>';
            while ($do_block->next()) {
                $html .= '
				<table cellspacing="0" cellpadding="1" border="1" width="800px;">
					<tbody>
						<tr style="background-color:#eeeeee;line-height:100%;">
							<td colspan="4" height="35"><b>' . $do_block->block_label . '</b></td>
						</tr>';
                $do_crmfields->get_form_fields_information($do_block->idblock, $module_id);
                $num_fields = $do_crmfields->getNumRows();
                $tot_count = 0;
                while ($do_crmfields->next()) {
                    $fieldobject = 'FieldType' . $do_crmfields->field_type;
                    $fields_count++;
                    $tot_count++;
                    if ($tot_count == 1 || $tot_count % 2 != 0) {
                        $html .= '<tr>';
                    }
                    $html .= '<td style="background-color:#FDFFBD;width:25%;" height="20">' . $do_crmfields->field_label . '</td>';
                    $fld_name = $do_crmfields->field_name;
                    $field_value = '';
                    if ($do_crmfields->field_type == 12) {
                        $field_value = $fieldobject::display_value($module_obj->{$fld_name}, 'l');
                    } elseif ($do_crmfields->field_type == 11) {
                        $field_value = $fieldobject::display_value($module_obj->{$fld_name}, $module, $sqcrm_record_id, $fld_name, true);
                    } else {
                        $field_value = $do_crmfields->display_field_value($module_obj->{$fld_name}, $do_crmfields->field_type, $fieldobject, $module_obj, $module_id, false);
                    }
                    $html .= '<td height="20" style="width:25%;">' . $field_value . '</td>';
                    if ($tot_count != 1 && $tot_count % 2 == 0) {
                        $html .= '</tr>';
                    }
                    if ($num_fields == $tot_count && $tot_count % 2 != 0) {
                        $html .= '
							<td style="background-color:#FDFFBD;width:25%" height="20">&nbsp;</td>
							<td height="20" style="width:25%">&nbsp;</td>
						</tr>';
                    }
                }
                $html .= '</tbody></table>';
                $html .= '<br>';
            }
            $pdf->WriteHTML($html);
            $pdf->Output($module . '_' . $record_id . '.pdf', 'D');
            exit;
        }
    }