本文整理汇总了PHP中fix_date函数的典型用法代码示例。如果您正苦于以下问题:PHP fix_date函数的具体用法?PHP fix_date怎么用?PHP fix_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fix_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: summary_report
public function summary_report()
{
$users = array();
if (isModuleAdmin()) {
$u = DataObjectFactory::Factory('User');
$users = $u->getAll();
}
$this->view->set('users', $users);
if (isset($this->_data['filter'])) {
$cc = new ConstraintChain();
if (!empty($this->_data['from_date'])) {
$cc->add(new Constraint('enddate', '>', fix_date($this->_data['from_date'])));
}
if (!empty($this->_data['to_date'])) {
$cc->add(new Constraint('enddate', '<', fix_date($this->_data['to_date'])));
}
if (!isModuleAdmin()) {
$cc->add(new Constraint('assigned', '=' . EGS_USERNAME));
} elseif (!empty($this->_data['assigned'])) {
$cc->add(new Constraint('assigned', '=', $this->_data['assigned']));
}
$opp_sh = new SearchHandler(new OpportunityCollection($this->_templateobject), false);
$opp_sh->addConstraintChain($cc);
$opp_sh->extract();
$os = DataObjectFactory::Factory('Opportunitystatus');
$os->addSearchHandler('opportunities', $opp_sh);
$statuses = new OpportunitystatusCollection($os);
$sh = new SearchHandler($statuses, false);
$sh->extract();
$statuses->load($sh);
$this->view->set('statuses', $statuses);
$this->view->set('report_headings', array('name', 'company', 'person', 'enddate', 'type', 'cost', 'assigned'));
$this->view->set('cc', $cc);
}
}
示例2: revalue
function revalue($data, &$errors = array())
{
if (empty($data['transaction_date'])) {
$data['transaction_date'] = date(DATE_FORMAT);
}
$glperiod = GLPeriod::getPeriod(fix_date($data['transaction_date']));
if (!$glperiod || count($glperiod) == 0) {
$errors[] = 'No period exists for this date';
return false;
}
$data['value'] = bcsub($this->glbalance(), $data['new_balance']);
$data['glperiods_id'] = $glperiod['id'];
$data['source'] = 'C';
$data['type'] = 'V';
$data['glaccount_id'] = $this->currency_detail->writeoff_glaccount_id;
$data['glcentre_id'] = $this->currency_detail->glcentre_id;
GLTransaction::setTwinCurrency($data);
$gl_trans[] = GLTransaction::Factory($data, $errors);
$data['value'] = bcmul($data['value'], -1);
$data['glaccount_id'] = $this->glaccount_id;
$data['glcentre_id'] = $this->glcentre_id;
GLTransaction::setTwinCurrency($data);
$gl_trans[] = GLTransaction::Factory($data, $errors);
$db = DB::Instance();
$db->StartTrans();
if (count($errors) == 0 && GLTransaction::saveTransactions($gl_trans, $errors)) {
return $db->CompleteTrans();
}
$errors[] = 'Failed to save GL Transaction';
$db->FailTrans();
$db->CompleteTrans();
return false;
}
示例3: index
public function index()
{
$this->view->set('clickaction', 'view');
$s_data = array();
// Set context from calling module
if (isset($this->_data['slmaster_id'])) {
$s_data['slmaster_id'] = $this->_data['slmaster_id'];
}
if (isset($this->_data['status'])) {
$s_data['status'] = $this->_data['status'];
}
$this->setSearch('sltransactionsSearch', 'useDefault', $s_data);
$transaction_date = $this->search->getValue('transaction_date');
if (isset($transaction_date['from'])) {
$from_date = fix_date($transaction_date['from']);
} else {
$from_date = '';
}
if (isset($transaction_date['to'])) {
$to_date = fix_date($transaction_date['to']);
} else {
$to_date = '';
}
parent::index(new SLTransactionCollection($this->_templateobject));
$this->view->set('search', $s_data);
}
示例4: save
public function save()
{
$flash = Flash::Instance();
$errors = array();
$data = $this->_data[$this->modeltype];
$obj = '';
if (!empty($data['task_id'])) {
$obj = new Task();
$obj->load($data['task_id']);
} elseif (!empty($data['project_id'])) {
$obj = new Project();
$obj->load($data['project_id']);
}
if ($obj instanceof DataObject && $obj->isLoaded()) {
if (fix_date($data['start_date']) < $obj->start_date) {
$errors['start_date'] = 'Start date before ' . get_class($obj) . ' start date';
}
if (fix_date($data['end_date']) > $obj->end_date) {
$errors['end_date'] = 'End date after ' . get_class($obj) . ' end date';
}
}
if (!empty($data['person_id']) && $data['quantity'] > 1) {
$errors['person_id'] = 'Quantity must be 1 for a person';
}
if (count($errors) == 0 && parent::save($this->modeltype, '', $errors)) {
sendBack();
} else {
$flash->addErrors($errors);
$this->refresh();
}
}
示例5: getRemittance
function getRemittance(&$_data = array(), &$model = array(), &$extra = array(), &$errors = array())
{
// load the model
$supplier = DataObjectFactory::Factory('PLSupplier');
$supplier->load($this->plmaster_id);
$_data['email_subject'] = $supplier->name . ' Remittance ' . $this->transaction_date;
$_data['filename'] = 'Remittance-' . $this->id;
// get the payment method
$plpayment = DataObjectFactory::Factory('PLPayment');
$plpayment->load($this->cross_ref);
// get the remittance list
$pltransactions = new PLAllocationCollection(DataObjectFactory::Factory('PLAllocation'));
$pltransactions->remittanceList($this->id);
$model = array($supplier, $pltransactions);
// set date
// a bit messy nesting in so many functions
$extra['date'] = un_fix_date(fix_date(date(DATE_FORMAT)));
// set company name
$company = DataObjectFactory::Factory('Company');
$company->load(COMPANY_ID);
$extra['company_name'] = $company->name;
// set company address
$company_address = array('name' => $company->name);
$output = array();
$parts = array("street1", "street2", "street3", "town", "county", "postcode", "country");
$address = $company->getAddress();
foreach ($parts as $part) {
if (!is_null($address->{$part})) {
$output[$part] = $address->{$part};
}
}
$company_address += $output;
$extra['company_address'] = $company_address;
// set the company details
$email = $company->getContactDetail('E', 'REMITTANCE');
if (empty($email)) {
$email = $company->getContactDetail('E');
}
$_data['replyto'] = $email;
$extra['company_details'] = array('tel' => 'Tel: ' . $company->getContactDetail('T'), 'fax' => 'Fax: ' . $company->getContactDetail('F'), 'email' => 'Email: ' . $email, 'vat_number' => 'VAT Number: ' . $company->vatnumber, 'company_number' => 'Company Number: ' . $company->companynumber);
// set supplier address
$supplier_address = array('name' => $supplier->name);
$output = array();
$parts = array("street1", "street2", "street3", "town", "county", "postcode", "country");
$address = $supplier->getBillingAddress();
foreach ($parts as $part) {
if (!is_null($address->{$part})) {
$output[$part] = $address->{$part};
}
}
$supplier_address += $output;
$extra['supplier_address'] = $supplier_address;
// set document details
$document_reference = array();
$document_reference[]['line'] = array('label' => 'Payment Date', 'value' => un_fix_date($this->transaction_date));
$document_reference[]['line'] = array('label' => 'Payment Value', 'value' => bcmul($this->gross_value, -1, 2));
$document_reference[]['line'] = array('label' => 'Currency', 'value' => $plpayment->currency);
$document_reference[]['line'] = array('label' => 'Payment Method', 'value' => $plpayment->payment_type);
$extra['document_reference'] = $document_reference;
}
示例6: copyStructure
function copyStructure($data, &$errors)
{
$mfstructures = new MFStructureCollection(DataObjectFactory::Factory('MFStructure'));
$cc1 = new ConstraintChain();
$cc1->add(new Constraint('stitem_id', '=', $data->stitem_id));
$cc1->add(new Constraint('start_date', '<=', fix_date(date(DATE_FORMAT))));
$cc2 = new ConstraintChain();
$cc2->add(new Constraint('end_date', '>=', fix_date(date(DATE_FORMAT))));
$cc2->add(new Constraint('end_date', 'is', 'NULL'), 'OR');
$sh = new SearchHandler($mfstructures, false);
$sh->addConstraintChain($cc1);
$sh->addConstraintChain($cc2);
$mfstructures->load($sh);
$wo_structure = array();
$wo_structures = array();
$copyfields = array('line_no', 'qty', 'uom_id', 'remarks', 'waste_pc', 'ststructure_id');
foreach ($mfstructures as $input) {
$wo_structure['work_order_id'] = $data->id;
foreach ($copyfields as $field) {
$wo_structure[$field] = $input->{$field};
}
$wo_structures[$input->line_no] = DataObject::Factory($wo_structure, $errors, 'MFWOStructure');
}
return $wo_structures;
}
示例7: Factory
public static function Factory($data, &$errors = array(), $do_name = null)
{
if (empty($data['calendar_week'])) {
$data['calendar_week'] = date('W', strtotime(fix_date($data['period_start_date'], DATE_TIME_FORMAT, $errors)));
}
return parent::Factory($data, $errors, $do_name);
}
示例8: makeHeader
public static function makeHeader($data, $do, &$errors)
{
if (strtotime(fix_date($data['order_date'])) > strtotime(fix_date(date(DATE_FORMAT)))) {
$errors[] = 'Order Date cannot be in the future';
return false;
}
if (!isset($data['id']) || $data['id'] == '') {
// $generator = new OrderNumberHandler();
$generator = new UniqueNumberHandler(false, $data['type'] != 'T');
$data['order_number'] = $generator->handle(DataObjectFactory::Factory($do));
$data['status'] = 'N';
$user = getCurrentUser();
$data['raised_by'] = $user->username;
}
//determine the base currency
$currency = DataObjectFactory::Factory('Currency');
$currency->load($data['currency_id']);
$data['rate'] = $currency->rate;
//determine the twin currency
$glparams = DataObjectFactory::Factory('GLParams');
$twin_currency = DataObjectFactory::Factory('Currency');
$twin_currency->load($glparams->base_currency());
$data['twin_rate'] = $twin_currency->rate;
$data['twin_currency_id'] = $twin_currency->id;
return DataObject::Factory($data, $errors, $do);
}
示例9: loadPeriod
public function loadPeriod($date)
{
// Loads the period in which the supplied date falls
$subquery = "(SELECT min(enddate) \r\n\t\t\t\t FROM gl_periods z\r\n\t\t\t\t WHERE z.enddate >= '" . fix_date($date) . "' AND z.usercompanyid = " . EGS_COMPANY_ID . ")";
$cc = new ConstraintChain();
$cc->add(new Constraint('enddate', '=', $subquery));
return $this->loadBy($cc);
}
示例10: getCurrent
function getCurrent($cc = null)
{
if (!$cc instanceof ConstraintChain) {
$cc = new ConstraintChain();
}
$cc1 = new ConstraintChain();
$cc1->add(new Constraint('end_date', 'is', 'NULL'));
$cc1->add(new Constraint('end_date', '>', fix_date(date(DATE_FORMAT))), 'OR');
$cc->add($cc1);
}
示例11: populate
function populate()
{
$pp = new PeriodicPaymentCollection();
$pl = new PageList('overdue_periodic_payments');
$sh = new SearchHandler($pp, false);
$sh->addConstraint(new Constraint('status', '=', "('A')"));
$sh->addConstraint(new Constraint('next_due_date', '<=', fix_date(date(DATE_FORMAT))));
$this->setSearchLimit($sh);
$sh->setOrderBy('next_due_date');
$pp->load($sh);
$this->contents = $pp;
}
示例12: validate
public function validate($_value, &$errors = array())
{
switch ($this->data_type) {
case 'date':
$date = fix_date($_value, $this->external_format, $errors);
if ($date === false) {
return $_value;
}
return un_fix_date($date);
break;
}
}
示例13: get_week_dates
public function get_week_dates(&$errors = array())
{
if (!$this->isLoaded()) {
$this->loadBy('usercompanyid', EGS_COMPANY_ID);
}
if (!$this->isLoaded()) {
$errors[] = 'Cannot find HR Parameters';
return FALSE;
}
$dates['week_start_date'] = fix_date(date(DATE_FORMAT, strtotime('last ' . $this->week_start_day))) . ' ' . $this->week_start_time . ':00';
$dates['week_end_date'] = fix_date(date(DATE_FORMAT, strtotime($dates['week_start_date'] . ' + 7day'))) . ' ' . $this->week_start_time . ':00';
return $dates;
}
示例14: populate
function populate()
{
$pl = new PageList('companies_added_today');
$companies_do = new CompanyCollection(new Company());
$sh = new SearchHandler($companies_do, false);
$sh->extract();
$sh->addConstraint(new Constraint('is_lead', '=', 'false'));
$sh->addConstraint(new Constraint('created', '>', fix_date(date(DATE_FORMAT))));
$sh->setLimit(10);
$companies_do->load($sh);
$pl->addFromCollection($companies_do, array('module' => 'contacts', 'controller' => 'companys', 'action' => 'view'), array('id'), 'company', 'name');
$this->contents = $pl->getPages()->toArray();
}
示例15: populate
function populate()
{
$orders = new POrderLineCollection();
$orders->setParams();
$sh = new SearchHandler($orders, false);
$sh->addConstraint(new Constraint('status', 'in', "('A','P')"));
$sh->addConstraint(new Constraint('order_status', '!=', "X"));
$sh->addConstraint(new Constraint('due_delivery_date', '<', fix_date(date(DATE_FORMAT))));
$this->setSearchLimit($sh);
$sh->setOrderBy(array('due_delivery_date', 'id'));
$orders->load($sh);
$this->contents = $orders;
}