Я пытаюсь обновить настройки (Recurring Invoice), но у меня возникли небольшие проблемы.
Я пытаюсь сделать это, где я делаю это …
<?php require 'initapp.php'; $self='invoice-recurring.php'; $rself='all-recurring-invoice.php'; if (isset($_POST['submit'])){
$cid = _post('client');
if ($cid=='' OR $cid=='0'){
conf($self,'e','Client Name is Required.');
}
$idate = _post('date');
$date=date("Y-m-d", strtotime($idate));
if ($date==''){
conf($self,'e','Date is Required.');
}
$item = _post('item');
if ($item==''){
conf($self,'e','Item Name is Required.');
}
$note = _post('note');
$note=html_entity_decode($note);
$recurring = _post('frequency');
if ($recurring==''){
conf($self,'e','Frequency is Required.');
} //starts added on 3-7-2015 //$occurance = _post('occurance'); // if ($occurance==''){ // conf($self,'e','Occurance is Required.'); // } //stops
$price= _post('price');
if ($price==''){
conf($self,'e','Price is Required.');
}
$discount=_post('discount');
$disc_calculate=($discount*$price/100);
$tax=_post('tax'); if ($tax!='0'){ $tax = ORM::for_table('taxes')->find_one($tax); $trate = $tax['rate']; $tname = $tax['name']; $ttype = $tax['type']; if ($ttype=='Excluded'){ $tval = ($price*$trate)/100; $intotal = $price+$tval;
}
else {
$tval = ($price*$trate)/100;
$intotal = $price-$tval;
}
}
else{
$intotal=$price;
$tval='0';
$tname='None';
}$created = $date;
$add_days =$recurring;
$paiddate = date('Y-m-d',strtotime($date) + (24*3600*$add_days)); //add or delete * $occurance added on 3-7-2015 //$emailnotify='Yes'; $emailnotify = $aclient->emailnotify;//added on 2-25-2015
$intotal=$intotal-$disc_calculate; $paymentmethod=_post('paymentmethod');
$d = ORM::for_table('invoices')->create();
$d->userid = $cid;
$d->iteam = $item;
$d->created = $date;
$d->duedate = $date;
$d->nextduedate=$paiddate;
$d->datepaid=$date;
$d->subtotal = $price;
$d->total = $intotal;
$d->discount = $discount;
$d->paymentmethod=$paymentmethod;
$d->note = $note;
$d->tax=$tval;
$d->taxname=$tname;
$d->status = 'Unpaid';
$d->recurring = $recurring;
//$d->occurance = $occurance;//added on 3-7-2015
$d->save();
$invoiceid= $d->id();
if ($emailnotify=='Yes'){
$sysEmail=appconfig('Email');
$sysCompany=appconfig('CompanyName');
$sysUrl= appconfig('sysUrl');
$d= ORM::for_table('email_templates')->where('tplname', 'Customer Invoice Created')->find_one();
$cl = ORM::for_table('accounts')->find_one($cid);
$name = $cl['name'];
$email = $cl['email'];
$template = $d['message'];
$subject = $d['subject'];
$send = $d['send'];
$data = array('name' => $name,
'logo'=> '<img width="61" height="76" border="0" src="'.$sysUrl.'/assets/uploads/logo.jpg">',
'business_name'=> $sysCompany,
'invoice_id'=> $invoiceid,
'invoice_item'=> $item,
'invoice_amount'=> $intotal,
'sys_url' => $sysUrl
);
$message = _render($template,$data);
$mail_subject = _render($subject,$data);$body = $message;
if ($send=='1'){
$smtp=ORM::for_table('smtp_setting')->find_one('1');
$smtp_status=$smtp['status'];
if($smtp_status!='1'){
require ('../lib/pnp/email/class.phpmailer.php') ;
$mail = new PHPMailer();
$mail->SetFrom($sysEmail, $sysCompany);
$mail->AddReplyTo($sysEmail, $sysCompany);
$mail->AddAddress($email, $name);
$mail->Subject = $mail_subject;
$mail->MsgHTML($body);
$mail->Send();
}else{
require ('../lib/plugin/PHPMailer/PHPMailerAutoload.php');
$host_name=$smtp['host_name'];
$username=$smtp['username'];
$password=$smtp['password'];
$port=$smtp['port'];
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = "$host_name"; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = "$username"; // SMTP username
$mail->Password ="$password"; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = "$port";
$mail->SetFrom($sysEmail, $sysCompany);
$mail->AddReplyTo($sysEmail, $sysCompany);
$mail->AddAddress($email, $name);
$mail->Subject = $mail_subject;
$mail->MsgHTML($body);
$mail->Send();
}
}
}conf("invoice-manage.php?_inid=$invoiceid",'s','Recurring Invoice Add Successfully'); } conf($self,'e','Invoice does not Create Successfully'); ?>
Скорее всего, вам нужно время и / или продолжительность / продолжительность мероприятия. Вы можете использовать для этого cron или отправить мне в личку. Я написал скрипт php.
Других решений пока нет …