MP_Reports::get_calc( int $lead, string $title )
Get calc data.
Contents
Parameters Parameters
- $lead
-
(int) (Required) lead id.
- $title
-
(string) (Required) title.
Return Return
(array)
Source Source
File: mortgage-platform/Inc/Callback/MP_Reports.php
protected function get_calc( $lead, $title ) {
$calc = array();
$l_lead = $title;
$lead_calc = get_post_meta( $lead, MortgagePlatform::$prefix . 'lead_searches' );
$l_calc = array();
foreach ( $lead_calc as $item ) {
if ( ! empty( $item['loanAmount'] ) && '0' !== $item['loanAmount'] &&
! empty( $item['interest'] ) && '0' !== $item['interest'] &&
! empty( $item['downPayment'] ) && '0' !== $item['downPayment'] &&
! empty( $item['term'] ) && '0' !== $item['term']
) {
$loan_amount = (int) preg_replace( '/[^0-9]/', '', $item['loanAmount'] );
$interest = (int) preg_replace( '/[^0-9]/', '', $item['interest'] );
$down_payment = (int) preg_replace( '/[^0-9]/', '', $item['downPayment'] );
$term = $item['term'];
$l_calc = array( $loan_amount, $interest, $down_payment, $term );
array_push( $calc, array( $l_lead, $l_calc ) );
}
}
return $calc;
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |