/** * function to get data history display text * @param object $obj * @param boolean $link * @param boolean $user_history * @return array $ret_array */ public function get_data_history_display_text($obj, $link = false, $user_history = false) { $row1 = '<strong>' . $obj->firstname . ' ' . $obj->lastname . '</strong> ' . _('on ') . '<i>' . i18nDate::i18n_long_time(TimeZoneUtil::convert_to_user_timezone($obj->date_modified, true)) . '</i>'; switch ($obj->action) { case 'add': if ($user_history === true) { $row2 = _('Added') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule); } else { $row2 = _('Added the record'); } break; case 'delete': if ($user_history === true) { $row2 = _('Deleted') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule); } else { $row2 = _('Deleted the record'); } break; case 'edit': if ($user_history === true) { $row2 = _('Updated') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule); } else { $row2 = _('Updated the record'); } break; case 'value_changes': $do_crm_fields = new CRMFields(); $do_crm_fields->getId($obj->idfields); if ($do_crm_fields->getNumRows() > 0) { $field_label = $do_crm_fields->field_label; $old_value = $obj->old_value; $new_value = $obj->new_value; if ($do_crm_fields->field_type == 9) { $old_value = FieldType9::display_value($old_value); $new_value = FieldType9::display_value($new_value); } if ($user_history === true) { $row2 = _('Changed value in') . ' ' . CommonUtils::get_module_name_as_text($obj->idmodule) . ' , ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value; } else { $row2 = _('Changed') . ' ' . $field_label . ' :: ' . $old_value . ' >>> ' . $new_value; } } $do_crm_fields->free(); break; } if ($obj->user_avatar != '') { $avatar_path = $GLOBALS['AVATAR_DISPLAY_PATH']; $thumb = $avatar_path . '/ths_' . $obj->user_avatar . '.' . $obj->file_extension; } if ($link === true) { $detail_url = NavigationControl::getNavigationLink($_SESSION["do_module"]->modules_full_details[$obj->idmodule]["name"], "detail", $obj->id_referrer); $row2 .= ' <a href="' . $GLOBALS['SITE_URL'] . $detail_url . '">' . $GLOBALS['SITE_URL'] . $detail_url . '</a>'; } $ret_array = array("avatar" => $thumb, "row1" => $row1, "row2" => $row2); return $ret_array; }
<div class="row" id="cv_date_filter"> <div class="col-xs-8"> <div class="row"> <div class="col-xs-3"> <label class="control-label" for=""><?php echo _('Start date');?></label> </div> <div class="col-xs-5"> <?php echo FieldType9::display_field('cv_date_start');?> </div> </div> <div class="row"> <div class="col-xs-3"> <label class="control-label" for=""><?php echo _('End date');?></label> </div> <div class="col-xs-5"> <?php echo FieldType9::display_field('cv_date_end');?> </div> </div> </div> </div> </div> <div class="box_content_header"><strong><?php echo _('Advanced filter');?></strong> <hr class="form_hr"> <?php $cnt = 0; for ($i=0;$i<=4;$i++) { $cnt++; ?> <div class="row"> <div class="col-xs-4">
<div class="modal-body"> <?php echo _('Are you sure you want to delete the queue ?');?> </div> <div class="modal-footer"> <a href="#" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> <?php echo _('Close');?></a> <input type="submit" class="btn btn-primary delete_queue_entity_submit" value="<?php echo _('Delete')?>"/> </div> </div> </div> </div> <!--<div class="modal fade hide datadisplay-outer" id="add_queue_entity"> <div class="modal-body datadisplay-outer" id="queue-add-modal"> <?php echo _('Queue date :: ') ; echo '<br />'.FieldType9::display_field('entity_queue_date'); ?> </div> <div class="modal-footer"> <a href="#" class="btn btn-inverse" data-dismiss="modal"><i class="icon-white icon-remove-sign"></i> <?php echo _('Close'); ?></a> <input type="submit" class="btn btn-primary add_queue_entity_submit" id="" value="<?php echo _('add')?>"/> </div> </div>--> <!--<div class="modal fade hide datadisplay-outer" id="edit_queue_entity"> <div class="modal-body datadisplay-outer" id="queue-edit-modal"></div> <div class="modal-footer"> <a href="#" class="btn btn-inverse" data-dismiss="modal"><i class="icon-white icon-remove-sign"></i> <?php echo _('Close'); ?></a> <input type="submit" class="btn btn-primary update_queue_entity_submit" id="" value="<?php echo _('change')?>"/> </div> </div>--> <!--<div class="modal fade hide" id="delete_queue_entity">
/** * function to create a new potential at the time of conversion * @param object $evctl * @param array $assigned_to_data * @param integer $related_to * @param integer $related_to_module * @return integer $idpotentials */ public function create_new_potential_converted($evctl, $assigned_to_data, $related_to, $related_to_module) { $this->insert("potentials", array("potential_name" => $evctl->potential_name, "expected_closing_date" => FieldType9::convert_before_save($evctl->expected_closing_date), "sales_stage" => $evctl->sales_stage, "probability" => $evctl->probability, "amount" => FieldType30::convert_before_save($evctl->amount), "iduser" => $assigned_to_data["value"], "added_on" => date("Y-m-d H:i:s"), "lost_reason" => $evctl->lost_reason, "competitor_name" => $evctl->competitor_name)); $idpotentials = $this->getInsertId(); $this->insert("potentials_custom_fld", array("idpotentials" => $idpotentials)); $this->insert("potentials_related_to", array("idpotentials" => $idpotentials, "related_to" => $related_to, "idmodule" => $related_to_module)); return $idpotentials; }
public static function display_value($value) { $value = TimeZoneUtil::convert_to_user_timezone($value, true); $val = explode(" ", $value); $date = parent::display_value($val[0]); $time = i18nDate::i18n_time($val[1]); return $date . ' ' . $time; }
<label class="control-label" for=""><?php echo _('Start date'); ?> </label> <div class="controls"> <?php echo FieldType9::display_field('report_date_start', $report_date_start); ?> </div> <label class="control-label" for=""><?php echo _('End date'); ?> </label> <div class="controls"> <?php echo FieldType9::display_field('report_date_end', $report_date_end); ?> </div> </div> </td> </tr> </table> </div> <div class="box_content"> <p><?php echo _('Select advanced filter options for the report'); ?> </p> <table> <?php $cnt = 0;
/** * function to generate inventory (quote,invoice,sales order,purchase order) PDF * @param integer $idquotes * @param boolean $save * @see http://www.mpdf1.com/mpdf/index.php */ public function generate_inventory_pdf($idrecord, $idmodule, $save = false) { include_once BASE_PATH . THIRD_PARTY_LIB_PATH . "/mpdf/mpdf.php"; //echo BASE_PATH.THIRD_PARTY_LIB_PATH ;exit; $pdf = new \mPDF(); $crm_global_settings = new \CRMGlobalSettings(); if ($idmodule == 13) { $obj = new \Quotes(); $obj->getId($idrecord); $prefix = $crm_global_settings->get_setting_data_by_name('quote_num_prefix'); $inventory_type = _('QUOTE'); $inv = 'q'; $inv_number_fld = 'quote_number'; $inv_date_fld = 'valid_till'; $file_name = 'Quote_' . $prefix . $obj->quote_number . '.pdf'; $inventory_number = _('Quote #'); } elseif ($idmodule == 14) { $obj = new \SalesOrder(); $obj->getId($idrecord); $prefix = $crm_global_settings->get_setting_data_by_name('salesorder_num_prefix'); $inventory_type = _('SALES ORDER'); $inv = 'so'; $inv_number_fld = 'sales_order_number'; $inv_date_fld = 'due_date'; $file_name = 'SalesOrder_' . $prefix . $obj->sales_order_number . '.pdf'; $inventory_number = _('Sales Order #'); } elseif ($idmodule == 15) { $obj = new \Invoice(); $obj->getId($idrecord); $prefix = $crm_global_settings->get_setting_data_by_name('invoice_num_prefix'); $inventory_type = _('INVOICE'); $inv = 'inv'; $inv_number_fld = 'invoice_number'; $inv_date_fld = 'due_date'; $file_name = 'Invoice_' . $prefix . $obj->invoice_number . '.pdf'; $inventory_number = _('Invoice #'); } elseif ($idmodule == 16) { $obj = new \PurchaseOrder(); $obj->getId($idrecord); $prefix = $crm_global_settings->get_setting_data_by_name('purchaseorder_num_prefix'); $inventory_type = _('PURCHASE ORDER'); $inv = 'po'; $inv_number_fld = 'po_number'; $inv_date_fld = 'due_date'; $file_name = 'PurchaseOrder_' . $prefix . $obj->po_number . '.pdf'; $inventory_number = _('Purchase Order #'); } $inventory_logo = $crm_global_settings->get_setting_data_by_name('inventory_logo'); $company_address = $crm_global_settings->get_setting_data_by_name('company_address'); $do_lineitems = new \Lineitems(); $do_lineitems->get_line_items($idmodule, $idrecord); $lineitems = array(); if ($do_lineitems->getNumRows() > 0) { while ($do_lineitems->next()) { $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, "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); } } $html = ''; if (is_array($lineitems) && count($lineitems) > 0) { //--load the stylesheet $stylesheet = file_get_contents(BASE_PATH . '/themes/custom-css/inventory_export.css'); $pdf->WriteHTML($stylesheet, 1); $html .= ' <div> <div class="inv_wrapper"> <h1 class="inv_heading">' . $inventory_type . '</h1> <div class="inv_address_wrapper"> <p class="inv_address_section"> <span class="inv_address_to_from">FROM:</span><br> ' . nl2br($company_address) . ' </p> </div> <div class="inv_company_address_wrapper"> <img class="inv_company_address_logo" src="' . $GLOBALS['FILE_UPLOAD_DISPLAY_PATH'] . '/' . $inventory_logo . '"> </div> </div> <div style="clear:both;"></div> <div class="inv_wrapper"> <div class="inv_address_wrapper"> <p class="inv_address_section"> <span class="inv_address_to_from">To:</span><br>' . $this->generate_to_address($obj, $inv) . ' </p> </div> <div class="inv_brief_section"> <table class="inv_brief_section_table"> <tr> <th class="inv_brief_section_table_heading"> <span>' . $inventory_number . '</span> </th> <td class="inv_brief_section_table_content"> <span>' . $prefix . $obj->{$inv_number_fld} . '</span> </td> </tr> <tr> <th class="inv_brief_section_table_heading"> <span>Date</span> </th> <td class="inv_brief_section_table_content"> <span>' . \FieldType9::display_value($obj->{$inv_date_fld}) . '</span> </td> </tr> <tr> <th class="inv_brief_section_table_heading"> <span>Amount Due</span> </th> <td class="inv_brief_section_table_content"> <span>' . \FieldType30::display_value($obj->grand_total) . '</span> </td> </tr> </table> </div> </div> <div style="clear:both;"></div> <br> '; $html .= ' <table class="inv_line_table"> <thead> <tr> <th class="inv_line_table_header inv_line_table_header_width_30"> <span>Item Name</span> </th> <th class="inv_line_table_header inv_line_table_header_width_10"> <span>Qty</span> </th> <th class="inv_line_table_header inv_line_table_header_width_30"> <span>Price</span> </th> <th class="inv_line_table_header inv_line_table_header_width_15"> <span>Total</span> </th> <th class="inv_line_table_header inv_line_table_header_width_15"> <span>Net Price</span> </th> </tr> </thead> '; $html .= '<tbody>'; foreach ($lineitems as $key => $items) { $line_discount = ''; if ($items["discount_type"] == 'direct') { $line_discount = _('Discount') . '-' . \FieldType30::display_value($items["discount_value"]); } elseif ($items["discount_type"] == 'percentage') { $line_discount = _('Discount') . '-' . $items["discount_value"] . ' %'; } else { $line_discount = _('Discount') . '-' . _('no discount'); } $line_tax = ''; if ($items["tax_values"] != '') { $line_tax = ' - ' . rtrim($items["tax_values"], ','); } else { $line_tax = ' - no tax'; } $html .= ' <tr> <td class="inv_line_table_content inv_line_table_content_vertical_top"> <div class="inv_line_table_content_block"> ' . $items["item_name"] . ' <br><br> ' . nl2br($items["item_description"]) . ' </div> </td> <td class="inv_line_table_content inv_line_table_content_vertical_top"> <div class="inv_line_table_content_block"> ' . \FieldType16::display_value($items["item_quantity"]) . ' </div> </td> <td class="inv_line_table_content"> <div class="inv_line_table_content_block"> ' . \FieldType30::display_value($items["item_price"]) . ' </div> <div class="inv_line_table_content_block"> ' . $line_discount . ' </div> <div class="inv_line_table_content_block"> <b>Total after discount</b> </div> <div class="inv_line_table_content_block"> <b>Tax </b> ' . $line_tax . ' </div> </td> <td class="inv_line_table_content"> <div class="inv_line_table_content_block"> ' . \FieldType30::display_value($items["item_price"] * $items["item_quantity"]) . ' </div> <div class="inv_line_table_content_block"> ' . \FieldType30::display_value($items["discounted_amount"]) . ' </div> <div class="inv_line_table_content_block"> ' . \FieldType30::display_value($items["total_after_discount"]) . ' </div> <div class="inv_line_table_content_block"> ' . \FieldType30::display_value($items["taxed_amount"]) . ' </div> </td> <td class="inv_line_table_content inv_line_table_content_vertical_top"> ' . \FieldType30::display_value($items["net_total"]) . ' </td> </tr>'; } $html .= ' </tbody></table>'; $net_discount = ''; if ($obj->discount_type == 'percentage') { $net_discount = $obj->discount_value . ' %'; } elseif ($obj->discount_type == 'direct') { $net_discount = FieldType30::display_value($obj->discount_value); } else { $net_discount = _('no discount'); } $net_tax = ''; if ($obj->tax_values != '') { $net_tax = rtrim($obj->tax_values, ','); } $ship_hand_tax = ''; if ($obj->shipping_handling_tax_values != '') { $ship_hand_tax = rtrim($obj->shipping_handling_tax_values, ','); } $final_adj = ''; if ($obj->final_adjustment_type == 'add') { $final_adj = '(+)'; } elseif ($obj->final_adjustment_type == 'deduct') { $final_adj = '(-)'; } $html .= ' <div style="clear:both;"></div> <br> <div class="inv_grand_total_section"> <table class="inv_grand_total_table"> <tr> <td class="inv_grand_total_table_header"> <span><b>Net Total</b></span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->net_total) . '</span> </td> </tr> <tr> <td class="inv_grand_total_table_header"> <span><b>Discount -</b> ' . $net_discount . '</span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->discounted_amount) . '</span> </td> </tr> <tr> <td class="inv_grand_total_table_header"> <span><b>Tax -</b> ' . $net_tax . ' </span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->taxed_amount) . '</span> </td> </tr> <tr> <td class="inv_grand_total_table_header"> <span><b>Shipping/Handling charges</b></span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->shipping_handling_charge) . '</span> </td> </tr> <tr> <td class="inv_grand_total_table_header"> <span><b>Shipping/Handling Tax -</b>' . $ship_hand_tax . '</span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->shipping_handling_taxed_amount) . '</span> </td> </tr> <tr> <td class="inv_grand_total_table_header"> <span><b>Final Adjustment</b>' . $final_adj . '</span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->final_adjustment_amount) . '</span> </td> </tr> <tr> <td class="inv_grand_total_table_header"> <span><b>Grand Total</span> </td> <td class="inv_grand_total_table_content"> <span>' . \FieldType30::display_value($obj->grand_total) . '</span> </td> </tr> </table> </div> <div style="clear:both;"></div> <br> <h3 class="inv_terms_cond_section"> <span>Terms & Condition</span> </h3> <div style="top:2px;"> <p> ' . nl2br($obj->terms_condition) . ' </p> </div></div>'; } if (true === $save) { $pdf->WriteHTML($html); $pdf->Output(OUTBOUND_PATH . '/' . $file_name, 'F'); return $file_name; } else { $pdf->WriteHTML($html, 2); $pdf->Output($file_name, 'D'); exit; } }
echo _('Mode'); ?> </th> <th width="15%"><?php echo _('Transaction Type'); ?> </th> <th width="30%"><?php echo _('Note'); ?> </th> </tr> </thead> <tbody id="payment_details_tbody"> <?php if (count($payments) > 0) { foreach ($payments as $key => $val) { echo '<tr>'; echo '<td>' . FieldType9::display_value($val['date_added']) . '</td>'; echo '<td>' . FieldType30::display_value($val['amount']) . '</td>'; echo '<td>' . FieldType1::display_value($val['ref_num']) . '</td>'; echo '<td>' . FieldType1::display_value($val['mode_name']) . '</td>'; echo '<td>' . FieldType1::display_value($val['transaction_type']) . '</td>'; echo '<td>' . nl2br($val['additional_note']) . '</td>'; echo '</tr>'; } } ?> </tbody> </table> </div>
} $event_url = SITE_URL . NavigationControl::getNavigationLink("Calendar", "detail", $do_calendar->idevents); $reminder_time = strtotime("- {$d} days - {$h} hours - {$m} minutes ", strtotime($start_date_time)); if (strtotime($now) >= $reminder_time) { foreach ($email_to_array as $key => $val) { if ($key == 0) { foreach ($val as $additional_emailids) { $email_data = array("firstname" => "Hi", "event_type" => $do_calendar->event_type, "start_time" => FieldType10::display_value($start_time), "start_date" => FieldType9::display_value($start_date), "CRM_NAME" => CRM_NAME, "event_url" => $event_url, "subject" => $do_calendar->subject); $emailer->IsSendmail(); $emailer->setEmailTemplate($email_template); $emailer->mergeArray($email_data); $emailer->AddAddress($val["email"], $val["firstname"] . ' ' . $val["lastname"]); $emailer->send(); echo "Email Sent to " . $val["email"] . "\n"; } } else { $email_data = array("firstname" => $val["firstname"], "event_type" => $do_calendar->event_type, "start_time" => FieldType10::display_value($start_time), "start_date" => FieldType9::display_value($start_date), "CRM_NAME" => CRM_NAME, "event_url" => $event_url, "subject" => $do_calendar->subject); $emailer->IsSendmail(); $emailer->setEmailTemplate($email_template); $emailer->mergeArray($email_data); $emailer->AddAddress($val["email"], $val["firstname"] . ' ' . $val["lastname"]); $emailer->send(); echo "Email Sent to " . $val["email"] . "\n"; } } $qry = "\r\n\t\t\t\tupdate \r\n `events_reminder` \r\n set `reminder_send` = 1 \r\n where `idevents_reminder` = " . $do_event_reminder->idevents_reminder . " limit 1"; $GLOBALS['conn']->getDbConnection()->executeQuery($qry); } } } }
/** * function to get the recurrent dates * @param object $evctl * @return array containing the recurrent dates */ public function get_recurrent_dates($evctl) { $recurrent_options = (int) $evctl->recurrent_options; $this->set_recurrent_option_selected($recurrent_options); $repeat_end_type = (int) $evctl->repeat_end_opts; $this->set_repeat_end_type($repeat_end_type); if ($repeat_end_type == 1) { $repeat_end = (int) $evctl->repeat_end_num_occurence; $this->set_repeat_end_num_occurence($repeat_end); } elseif ($repeat_end_type == 2) { $repeat_end = $evctl->repeat_end_date; $this->set_repeat_end_date($repeat_end); } $start_date = FieldType9::convert_before_save($evctl->start_date); switch ($recurrent_options) { case 1: $this->set_repeat_freq_opts((int) $evctl->repeat_freq_opts); return $this->get_recurrent_dates_daily($start_date); break; case 2: return $this->get_recurrent_dates_weekdays($start_date); break; case 3: return $this->get_recurrent_dates_mon_wed_fri($start_date); break; case 4: return $this->get_recurrent_dates_tue_thu($start_date); break; case 5: $this->set_repeat_freq_opts((int) $evctl->repeat_freq_opts); $this->set_repeat_week_week_opts($evctl->weekly_opts); return $this->get_recurrent_dates_weekly($start_date); break; case 6: $this->set_repeat_freq_opts((int) $evctl->repeat_freq_opts); $this->set_repeat_monthly_opts((int) $evctl->repeat_monthly_opts); if ((int) $evctl->repeat_monthly_opts == 1) { $this->set_repeat_monthly_opts_days((int) $evctl->repeat_monthly_opts_days); } elseif ((int) $evctl->repeat_monthly_opts == 2) { $this->set_repeat_monthly_opts_week_freq($evctl->repeat_monthly_opts_week_freq); $this->set_repeat_monthly_opts_week_weekdays($evctl->repeat_monthly_opts_week_weekdays); } return $this->get_recurrent_dates_monthly($start_date); break; case 7: $this->set_repeat_freq_opts((int) $evctl->repeat_freq_opts); return $this->get_recurrent_dates_yearly($start_date); break; } }
echo '<br />'; } elseif ($recurrent_events_pattern["repeat_monthly_opts"] == 2) { echo $recurrent_events_pattern["repeat_monthly_opts_week_freq"].' '.$recurrent_events_pattern["repeat_monthly_opts_week_weekdays"]; echo '<br />'; } } if ($recurrent_events_pattern["repeat_end_opts"] == 1) { echo _('Ends after'); echo ' '; echo $recurrent_events_pattern["repeat_end_num_occurence"]; echo ' '; echo _('occurrences'); } elseif ($recurrent_events_pattern["repeat_end_opts"] == 2) { echo _('Ends on'); echo ' '; echo FieldType9::display_value($recurrent_events_pattern["repeat_end_date"]); } } } ?> </div> <div class="box_content"> <?php echo '<b>'._('Alert').'</b><br />'; if (false === $reminder) { echo _('Event alert is not set'); } else { if (is_array($reminder) && count($reminder) > 0) { echo _('Send alert '); echo '<br />'; echo $reminder["days"].' '._('day(s)');
/** * event function to add an entity to queue * @param object $evctl * @return string */ public function eventAjaxAddQueue(EventControler $evctl) { if (trim($evctl->date) != '' && (int) $evctl->related_module_id > 0 && (int) $evctl->related_record_id > 0) { $user_timezone = $_SESSION['do_user']->user_timezone; $date = FieldType9::convert_before_save($evctl->date); $today = TimeZoneUtil::get_user_timezone_date($user_timezone); $todayDateObj = new DateTime($today); $queueDateObj = new DateTime($date); $diff = $todayDateObj->diff($queueDateObj); $day_diff = $diff->format('%R%a'); if ($day_diff < 0) { echo _('Older date for queue is not allowed !'); } else { $this->addNew(); $this->sqcrm_record_id = (int) $evctl->related_record_id; $this->related_module_id = (int) $evctl->related_module_id; $this->iduser = $_SESSION['do_user']->iduser; $this->queue_date = $date; $this->add(); echo '1'; } } else { echo _('Missing module id , date or record id to be added in queue !'); } }
/** * event function to set the form data step wise on add/edit * sets the values in $_SESSION * @param object $evctl */ public function eventSetReportData(EventControler $evctl) { $step = (int) $evctl->step; switch ($step) { case 1: $next_step = $step + 1; $_SESSION["report_type"] = $evctl->report_type; $_SESSION["primary_module"] = ''; $_SESSION["secondary_module"] = ''; $_SESSION["report_fields"] = ''; $_SESSION["report_fields_data"] = ''; if ($evctl->mode == "edit") { $next_page = NavigationControl::getNavigationLink("Report", "edit"); $dis = new Display($next_page); $dis->addParam("sqrecord", $evctl->sqrecord); } else { $next_page = NavigationControl::getNavigationLink("Report", "add"); $dis = new Display($next_page); } $dis->addParam("step", $next_step); $evctl->setDisplayNext($dis); break; case 2: $next_step = $step + 1; $_SESSION["primary_module"] = $evctl->primary_module; $_SESSION["secondary_module"] = ''; $_SESSION["report_fields"] = ''; $_SESSION["report_fields_data"] = ''; if ($evctl->mode == "edit") { $next_page = NavigationControl::getNavigationLink("Report", "edit"); $dis = new Display($next_page); $dis->addParam("sqrecord", $evctl->sqrecord); } else { $next_page = NavigationControl::getNavigationLink("Report", "add"); $dis = new Display($next_page); } $dis->addParam("step", $next_step); $evctl->setDisplayNext($dis); break; case 3: $next_step = $step + 1; $_SESSION["secondary_module"] = $evctl->secondary_module; $_SESSION["report_fields"] = ''; $_SESSION["report_fields_data"] = ''; if ($evctl->mode == "edit") { $next_page = NavigationControl::getNavigationLink("Report", "edit"); $dis = new Display($next_page); $dis->addParam("sqrecord", $evctl->sqrecord); } else { $next_page = NavigationControl::getNavigationLink("Report", "add"); $dis = new Display($next_page); } $dis->addParam("step", $next_step); $evctl->setDisplayNext($dis); break; case 4: $next_step = $step + 1; $_SESSION["report_fields"] = $evctl->report_fields; $_SESSION["report_order_by"] = ''; if ($evctl->mode == "edit") { $next_page = NavigationControl::getNavigationLink("Report", "edit"); $dis = new Display($next_page); $dis->addParam("sqrecord", $evctl->sqrecord); } else { $next_page = NavigationControl::getNavigationLink("Report", "add"); $dis = new Display($next_page); } $dis->addParam("step", $next_step); $evctl->setDisplayNext($dis); break; case 5: $next_step = $step + 1; $report_order_by = array("order_by_1" => array("order_by_field" => $evctl->report_order_by_1, "order_by_type" => $evctl->report_order_by_type_1), "order_by_2" => array("order_by_field" => $evctl->report_order_by_2, "order_by_type" => $evctl->report_order_by_type_2), "order_by_3" => array("order_by_field" => $evctl->report_order_by_3, "order_by_type" => $evctl->report_order_by_type_3)); $_SESSION["report_order_by"] = $report_order_by; if ($evctl->mode == "edit") { $next_page = NavigationControl::getNavigationLink("Report", "edit"); $dis = new Display($next_page); $dis->addParam("sqrecord", $evctl->sqrecord); } else { $next_page = NavigationControl::getNavigationLink("Report", "add"); $dis = new Display($next_page); } $dis->addParam("step", $next_step); $evctl->setDisplayNext($dis); break; case 6: $next_step = $step + 1; $report_filter_options = array("date_filter_options" => array("report_date_field" => $evctl->report_date_field, "report_date_field_type" => $evctl->report_date_field_type, "report_date_start" => FieldType9::convert_before_save($evctl->report_date_start), "report_date_end" => FieldType9::convert_before_save($evctl->report_date_end)), "advanced_filter_options" => array("report_adv_fields_1" => $evctl->report_adv_fields_1, "report_adv_fields_type_1" => $evctl->report_adv_fields_type_1, "report_adv_fields_val_1" => $_POST["report_adv_fields_val_1"], "report_adv_fields_2" => $evctl->report_adv_fields_2, "report_adv_fields_type_2" => $evctl->report_adv_fields_type_2, "report_adv_fields_val_2" => $_POST["report_adv_fields_val_2"], "report_adv_fields_3" => $evctl->report_adv_fields_3, "report_adv_fields_type_3" => $evctl->report_adv_fields_type_3, "report_adv_fields_val_3" => $_POST["report_adv_fields_val_3"], "report_adv_fields_4" => $evctl->report_adv_fields_4, "report_adv_fields_type_4" => $evctl->report_adv_fields_type_4, "report_adv_fields_val_4" => $_POST["report_adv_fields_val_4"], "report_adv_fields_5" => $evctl->report_adv_fields_5, "report_adv_fields_type_5" => $evctl->report_adv_fields_type_5, "report_adv_fields_val_5" => $_POST["report_adv_fields_val_5"])); $_SESSION["report_filter"] = $report_filter_options; if ($evctl->mode == "edit") { $next_page = NavigationControl::getNavigationLink("Report", "edit"); $dis = new Display($next_page); $dis->addParam("sqrecord", $evctl->sqrecord); } else { $next_page = NavigationControl::getNavigationLink("Report", "add"); $dis = new Display($next_page); } $dis->addParam("step", $next_step); $evctl->setDisplayNext($dis); break; } }
/** * function to update the custom view date filter * @param integer $idcustom_view * @param integer $idfield * @param integer $filter_type * @param string $start_date * @param string $end_date * @return void */ public function update_custom_view_date_filter($idcustom_view, $idfield, $filter_type, $start_date, $end_date) { $qry = "\n\t\tselect * from `custom_view_date_filter`\n\t\twhere `idcustom_view` = ?\n\t\t"; $this->query($qry, array($idcustom_view)); if ($this->getNumRows() > 0) { if ((int) $idfield > 0 && (int) $filter_type > 0) { $cv_start_date = ''; $cv_end_date = ''; if ($start_date != '' && $end_date != '') { $cv_start_date = FieldType9::convert_before_save($start_date); $cv_end_date = FieldType9::convert_before_save($end_date); } $qry = "\n\t\t\t\tupdate `custom_view_date_filter`\n\t\t\t\t`idfield` = ?,\n\t\t\t\t`filter_type` = ?,\n\t\t\t\t`start_date` = ?,\n\t\t\t\t`end_date` = ?\n\t\t\t\twhere \n\t\t\t\t`idcustom_view` = ?\n\t\t\t\t"; $this->query($idfield, $filter_type, $cv_start_date, $cv_end_date, $idcustom_view); } } else { $this->add_custom_view_date_filter($idfield, $filter_type, $cv_start_date, $cv_end_date, $idcustom_view); } }
<label class="control-label" for=""><?php echo _('Start date'); ?> </label> <div class="controls"> <?php echo FieldType9::display_field('cv_date_start', $date_start); ?> </div> <label class="control-label" for=""><?php echo _('End date'); ?> </label> <div class="controls"> <?php echo FieldType9::display_field('cv_date_end', $date_end); ?> </div> </div> </td> </tr> </table> </div> <div class="box_content_header"><h3><?php echo _('Advanced filter'); ?> </h3> <table> <?php $cnt = 0;
/** * parse the date filter for the query * @param integer $idreport * @param array $data * @return string */ public function get_parsed_date_filter($idreport, $data = array()) { $date_where = ''; if (count($data) > 0) { $filter_type = $data["filter_type"]; $do_fields = new CRMFields(); $do_fields->getId((int) $data["idfield"]); $where_field = $do_fields->table_name . '.' . $do_fields->field_name; if ($data["start_date"] != '') { $start_date = FieldType9::convert_before_save($data["start_date"]); } if ($data["end_date"] != '') { $end_date = FieldType9::convert_before_save($data["end_date"]); } } else { $qry = $this->get_saved_date_filter(); $this->query($qry, array($idreport)); if ($this->getNumRows() > 0) { $this->next(); $filter_type = $this->filter_type; $field_name = $this->field_name; $where_field = $this->table_name . '.' . $field_name; if ($this->start_date != '' && $this->start_date != '0000-00-00') { $start_date = $this->start_date; } if ($this->end_date != '' && $this->end_date != '0000-00-00') { $end_date = $this->end_date; } } } if ($filter_type > 0) { switch ($filter_type) { case '1': if ($start_date != '' && $start_date != '0000-00-00' && $end_date != '' && $end_date != '0000-00-00') { $date_where = " AND " . $where_field . " between '" . $start_date . "' AND '" . $end_date . "'"; } break; case '2': $date_range = CommonUtils::get_year_date_range('previous'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '3': $date_range = CommonUtils::get_year_date_range('current'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '4': $date_range = CommonUtils::get_year_date_range('next'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '5': $date_range = CommonUtils::get_quarter_date_range('previous'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '6': $date_range = CommonUtils::get_quarter_date_range('current'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '7': $date_range = CommonUtils::get_quarter_date_range('next'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '8': $date_where = " AND " . $where_field . " between concat(date_sub(curdate(),interval 1 day),' 00:00:00') and concat(date_sub(curdate(),interval 1 day),' 23:59:59')"; break; case '9': $date_where = " AND " . $where_field . " between concat(curdate(),' 00:00:00') and concat(curdate(),' 23:59:59')"; break; case '10': $date_where = " AND " . $where_field . " between concat(date_add(curdate(),interval 1 day),' 00:00:00') and concat(date_add(curdate(),interval 1 day),' 23:59:59')"; break; case '11': $date_range = CommonUtils::get_week_date_range('previous'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '12': $date_range = CommonUtils::get_week_date_range('current'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '13': $date_range = CommonUtils::get_week_date_range('next'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '14': $date_range = CommonUtils::get_month_date_range('previous'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '15': $date_range = CommonUtils::get_month_date_range('current'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '16': $date_range = CommonUtils::get_month_date_range('next'); $date_where = " AND " . $where_field . " between '" . $date_range["start"] . "' AND '" . $date_range["end"] . "'"; break; case '17': $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 7 day) and date_sub(curdate(),interval 1 day)"; break; case '18': $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 30 day) and date_sub(curdate(),interval 1 day)"; break; case '19': $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 60 day) and date_sub(curdate(),interval 1 day)"; break; case '20': $date_where = " AND " . $where_field . " between date_sub(curdate(),interval 90 day) and date_sub(curdate(),interval 1 day)"; break; case '21': $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 7 day)"; break; case '22': $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 30 day)"; break; case '23': $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 60 day)"; break; case '24': $date_where = " AND " . $where_field . " between date_add(curdate(),interval 1 day) and date_add(curdate(),interval 90 day)"; break; } } return $date_where; }
echo _('Prospect Name'); ?> </label> <div class="controls"> <input type = "text" class="form-control input-sm" name="potential_name" id="potential_name" value="<?php echo $leads_obj->organization; ?> "> </div><br /> <label class="control-label" for="expected_closing_date">* <?php echo _('Expected Closing Date'); ?> </label> <div class="controls"> <?php echo FieldType9::display_field('expected_closing_date'); ?> </div><br /> <label class="control-label" for="sales_stage">* <?php echo _('Sales Stage'); ?> </label> <div class="controls"> <?php echo FieldType5::display_field('sales_stage', 117); ?> </div><br /> <label class="control-label" for="amount">* <?php echo _('Amount'); ?> </label>
echo $e_add->getFormEvent(); ?> <div class="row"> <div class="col-md-12"> <div class="row"> <div class="col-xs-4"> <label class="control-label" for="payment_date"><?php echo _('Payment Date'); ?> </label> </div> </div> <div class="row"> <div class="col-xs-4"> <?php echo FieldType9::display_field('payment_date'); ?> </div> </div> <br /> <div class="row"> <div class="col-xs-4"> <label class="control-label" for="payment_mode"><?php echo _('Payment Mode'); ?> </label> </div> </div> <div class="row"> <div class="col-xs-4"> <select name="payment_mode" id="payment_mode" class="form-control input-sm">
<?php $report_date_start = isset($_GET['report_date_start_runtime']) ? $_GET['report_date_start_runtime'] : ''; echo FieldType9::display_field('report_date_start_runtime', $report_date_start); ?> </div> <div class="left_300" <?php echo $date_range_display; ?> id="report_date_filter_end"> <?php echo _('Date end'); ?> <br /> <?php $report_date_end = isset($_GET['report_date_start_runtime']) ? $_GET['report_date_start_runtime'] : ''; echo FieldType9::display_field('report_date_end_runtime', $report_date_end); ?> </div> <div class="left_300" id="report_user_filter"> <?php echo _('User'); ?> <br /> <select name="report_user_filter_runtime" id="report_user_filter_runtime"> <option value="0"><?php echo _('All'); ?> </option> <?php if (is_array($user_list) && count($user_list) > 0) { foreach ($user_list as $key => $val) {
$repeat_end_opts_1_checked = "CHECKED"; $repeat_end_num_occurence = $recurrent_events_pattern["repeat_end_num_occurence"] ; $repeat_end_num_occurence_section = 'display:block;'; } elseif ($recurrent_events_pattern["repeat_end_opts"] == 2) { $repeat_end_opts_2_checked = "CHECKED"; $repeat_end_date_section = 'display:block;'; $repeat_end_date = $recurrent_events_pattern["repeat_end_date"] ; } echo '<input type="radio" class= "repeat_end_opts" name="repeat_end_opts" id="repeat_end_opts" value="1" '.$repeat_end_opts_1_checked.'>'.' '._('after').' '; echo '<div id="repeat_end_num_occurence_section" style="'.$repeat_end_num_occurence_section.'">'; echo '<input type="text" name="repeat_end_num_occurence" id="repeat_end_num_occurence" value = "'.$repeat_end_num_occurence.'" class="form-control input-sm">'; echo ' '._('occurrences'); echo '</div>'; echo '<input type="radio" class = "repeat_end_opts" name="repeat_end_opts" id="repeat_end_opts" value="2" '.$repeat_end_opts_2_checked.'>'.' '._('on').' '; echo '<div id="repeat_end_date_section" style="'.$repeat_end_date_section.'">'; FieldType9::display_field('repeat_end_date',$repeat_end_date,'input-medium'); echo '</div>'; ?> </div> </div> </div> <script> $(document).ready(function() { $("#event_repeat").click(function() { if ($("#event_repeat").is(':checked')) { $("#recurrent_options_section").show(); $("#repeat_freq_section").show(); $("#repeat_freq_section").append($("#daily_opts_section").html()); } else { $("#recurrent_options_section").hide();
/** * event function to add the invoice payment * @param object $evctl */ public function eventAjaxAddInvoicePayment(EventControler $evctl) { $err = false; $error_code = 0; if (trim($evctl->payment_date) == '') { $err = true; $error_code = 1; } elseif (trim($evctl->ref_num) == '') { $err = true; $error_code = 2; } elseif ((int) FieldType30::convert_before_save(trim($evctl->amount)) == 0) { $err = true; $error_code = 3; } elseif (true === $this->is_payment_more_than_due($evctl->idinvoice, FieldType30::convert_before_save(trim($evctl->amount)))) { $err = true; $error_code = 4; } if (true === $err) { echo $error_code; } else { $payment_date = FieldType9::convert_before_save($evctl->payment_date); $payment_mode = $evctl->payment_mode; $amount = FieldType30::convert_before_save($evctl->amount); $ref_num = CommonUtils::purify_input($evctl->ref_num); $additional_note = CommonUtils::purify_input($evctl->additional_note); $idinvoice = (int) $evctl->idinvoice; // add to paymentlog $do_paymentlog = new Paymentlog(); $do_paymentlog->addNew(); $do_paymentlog->date_added = $payment_date; $do_paymentlog->amount = $amount; $do_paymentlog->ref_num = $ref_num; $do_paymentlog->idpayment_mode = $payment_mode; $do_paymentlog->add(); $idpaymentlog = $do_paymentlog->getInsertId(); // add to invoice payment $this->addNew(); $this->idinvoice = $idinvoice; $this->idpaymentlog = $idpaymentlog; $this->additional_note = $additional_note; $this->iduser = $_SESSION["do_user"]->iduser; $this->add(); $qry = "\n\t\t\tselect * from `payment_mode` where `idpayment_mode` = ?\n\t\t\t"; $stmt = $this->getDbConnection()->executeQuery($qry, array($evctl->payment_mode)); $data = $stmt->fetch(); $payment_mode_name = $data['mode_name']; $html = ''; $html .= '<tr>'; $html .= '<td>' . FieldType9::display_value($payment_date) . '</td>'; $html .= '<td>' . FieldType30::display_value($amount) . '</td>'; $html .= '<td>' . FieldType1::display_value($ref_num) . '</td>'; $html .= '<td>' . FieldType1::display_value($payment_mode_name) . '</td>'; $html .= '<td>' . _('charge') . '</td>'; $html .= '<td>' . nl2br($additional_note) . '</td>'; $html .= '</tr>'; $invoice_payments = new InvoicePayments(); $due_amount = FieldType30::display_value($invoice_payments->get_due_amount($idinvoice)); echo json_encode(array('html' => $html, 'due_amount' => $due_amount)); } }
</div> <div id="yearly_opts_section" style="display:none;"></div> <div id="repeat_end_opts_section"> <?php echo _('Ends'); echo '<br />'; echo '<input type="radio" class= "repeat_end_opts" name="repeat_end_opts" id="repeat_end_opts" value="1" checked>'.' '._('after').' '; echo '<div id="repeat_end_num_occurence_section">'; echo '<input type="text" name="repeat_end_num_occurence" id="repeat_end_num_occurence" value = "10" class="input-small">'; echo ' '._('occurrences'); echo '</div>'; echo '<input type="radio" class = "repeat_end_opts" name="repeat_end_opts" id="repeat_end_opts" value="2" >'.' '._('on').' '; echo '<div id="repeat_end_date_section" style="display:none;">'; FieldType9::display_field('repeat_end_date','','form-control'); echo '<br />'; echo '</div>'; ?> </div> </div> </div> <script> $(document).ready(function() { $("#event_repeat").click(function() { if($("#event_repeat").is(':checked')) { $("#recurrent_options_section").show(); $("#repeat_freq_section").show(); $("#repeat_freq_section").append($("#daily_opts_section").html()); } else {