ねじ子web

ねじ子のLINEスタンプが発売されています

請求書発行依頼

ここは取引業者さん向けの特別なページです。

請求書の発行依頼を簡単にできるページを用意しました。

  • 件名、請求日などを入力して「確認」を押すと、消費税等が計算されます。
  • 消費税を加算しないものに対しては「実費」をチェックして下さい。
  • 合計金額などをご確認下さい。訂正あれば、訂正後再度「確認」を押して下さい。何度でも
    確認できます。
  • これで良いとなったら「送信」を押して下さい。

※ 源泉徴収は基本的には不要のはずです。消費税を含めてのご請求になります。


END;

// 変数の読み込み

if(!isset($status)){ $status = $_POST[‘status’]; }

// $seikyuy = $_POST[‘seikyuy’];
// $seikyum = $_POST[‘seikyum’];
// $seikyud = $_POST[‘seikyud’];

$sendfrom = $_POST[‘sendfrom’];
if(!isset($sendfrom)){$sendfrom = ‘SMS’;};

$billdate = $_POST[‘billdate’];
if(!isset($billdate)){$billdate = date(‘Y-m-d’);};

$subj = $_POST[‘subject’];

$detail[1] = $_POST[‘detail1’];
$unit[1] = $_POST[‘unit1’];
$quantity[1] = $_POST[‘quantity1’];

$detail[] = $_POST[‘detail2’];
$unit[] = $_POST[‘unit2’];
$quantity[] = $_POST[‘quantity2’];

$detail[] = $_POST[‘detail3’];
$unit[] = $_POST[‘unit3’];
$quantity[] = $_POST[‘quantity3’];

$detail[] = $_POST[‘detail4’];
$unit[] = $_POST[‘unit4’];
$quantity[] = $_POST[‘quantity4’];

$detail[] = $_POST[‘detail5’];
$unit[] = $_POST[‘unit5’];
$quantity[] = $_POST[‘quantity5’];

$detail[] = $_POST[‘detail6’];
$unit[] = $_POST[‘unit6’];
$quantity[] = $_POST[‘quantity6’];

$detail[] = $_POST[‘detail7’];
$unit[] = $_POST[‘unit7’];
$quantity[] = $_POST[‘quantity7’];

$detail[] = $_POST[‘detail8’];
$unit[] = $_POST[‘unit8’];
$quantity[] = $_POST[‘quantity8’];

$detail[] = $_POST[‘detail9’];
$unit[] = $_POST[‘unit9’];
$quantity[] = $_POST[‘quantity9’];

$memo = $_POST[‘memo’];

$sm = $_POST[‘submitbutton’];

if($_POST[‘jippi1’]){$jippi[1]=”checked”;}
if($_POST[‘jippi2’]){$jippi[2]=”checked”;}
if($_POST[‘jippi3’]){$jippi[3]=”checked”;}
if($_POST[‘jippi4’]){$jippi[4]=”checked”;}
if($_POST[‘jippi5’]){$jippi[5]=”checked”;}
if($_POST[‘jippi6’]){$jippi[6]=”checked”;}
if($_POST[‘jippi7’]){$jippi[7]=”checked”;}
if($_POST[‘jippi8’]){$jippi[8]=”checked”;}
if($_POST[‘jippi9’]){$jippi[9]=”checked”;}

if(!isset($joken)){ $joken=$_POST[‘joken’];$seikyu[1]=”checked”; } // default
if($joken == 1){$seikyu[1]=”checked”;$seikyu[2]=””;$seikyu[3]=””;}
if($joken == 2){$seikyu[1]=””;$seikyu[2]=”checked”;$seikyu[3]=””;}
if($joken == 3){$seikyu[1]=””;$seikyu[2]=””;$seikyu[3]=”checked”;}

// ここからがプログラム本体。合計などを計算。

$total =0; // 非実費合計
$jippitotal =0; // 実費合計
$totalnote =””;
$jippitotalnote=””;
$naiyou =””; // 小計の表示

for($i=1;$i<10;$i++){ $subtotal[$i]=str_replace(",", "", $unit[$i])*$quantity[$i]; if($subtotal[$i]<>0){
if($jippi[$i]==”checked”){
$jippitotal += $subtotal[$i];
if($jippitotalnote==””){$jippitotalnote .=”($i)”;}
else{$jippitotalnote .=”+($i)”;}}
else{
$total += $subtotal[$i];
if($totalnote==””){$totalnote .=”($i)”;}
else{$totalnote .=”+($i)”;}
}
}
// メール内容はwebとは独立に組み立てている
// web表示用
$naiyou .= “

($i)

“;
$naiyou .= “

“;
$naiyou .= “

“;
$naiyou .= “

$subtotal[$i]

“;
$naiyou .= “

“;
;}

$tax = floor($total * $stax); // 消費税は切り捨て
// 源泉は消費税のかかる前の金額にかかる。
// 100万以上だと料率が変更になる。復興税は計算に入っていない。
if($total>1000000){
$gensen = floor(($total-1000000)*0.2 + 100000) ;
$gensennote = “((A)-1000000)*0.2 + 100000)”;
}else{
$gensen = floor($total * 0.1);
$gensennote = “(A)*0.1”;
}

if(!$gensenflag){$gensen=0;$gensennote = “(不要)”;}; // 源泉徴収をナシにする。
$nyukin = $jippitotal + $total – $gensen + $tax;

if($status==”phase2″ && $sm==”送信”){
// メールの組み立て

//$message = “請求日 “.$seikyuy.”/”.$seikyum.”/”.$seikyud.”\n”;
$message = “請求日 “.$billdate.”\n”;
$message .= “宛先 $sendfrom \n”;
$message .= “件名 “.$subj.”\n”;
// 以下は内容と実費をわけるために2回ループさせている。
for($i=1;$i<10;$i++){ if(!$subtotal[$i]==0 && !$jippi[$i]=="checked"){ $message.="内容 ".$detail[$i]." @".$unit[$i]." x ".$quantity[$i]."\n"; } } for($i=1;$i<10;$i++){ if(!$subtotal[$i]==0 && $jippi[$i]=="checked"){ $message.="実費 ".$detail[$i]." @".$unit[$i]." x ".$quantity[$i]."\n"; } } if($joken == 1){$message .= "条件 [翌月]末まで下記銀行口座への振込による\n";} if($joken == 2){$message .= "条件 [翌々月]末まで下記銀行口座への振込による\n";} if($joken == 3){} $message.= "\n非実費分合計 ".$total."\n"; $message.= "消費税 ".$tax."\n"; $message.= "実費合計 ". $jippitotal."\n"; $message.= "源泉所得税 ". $gensen."\n"; $message.= "振込金額 ".$nyukin."\n"; $message.= "備考 ".$memo; if(!$gensenflag){$message.= "\n(源泉所得税 はありません。)\n";}; $message.= "(消費税は ×".$stax."で計算されています。)\n

“;

// web用
//$wwwmessage = “

請求日 “.htmlspecialchars($seikyuy).”/”.htmlspecialchars($seikyum).”/”.htmlspecialchars($seikyud).”

“;
$wwwmessage = “

請求日 “.htmlspecialchars($billdate).”

“;
$wwwmessage .= “

宛先 $sendfrom

“;
$wwwmessage .= “

件名 “.htmlspecialchars($subj).”

“;
for($i=1;$i<10;$i++){ if(!$subtotal[$i]==0 && !$jippi[$i]=="checked"){ $wwwmessage.="

内容 “.htmlspecialchars($detail[$i]).” @”.htmlspecialchars($unit[$i]).” x “.htmlspecialchars($quantity[$i]).”

“;
}
}
for($i=1;$i<10;$i++){ if(!$subtotal[$i]==0 && $jippi[$i]=="checked"){ $wwwmessage.="

実費 “.htmlspecialchars($detail[$i]).” @”.htmlspecialchars($unit[$i]).” x “.htmlspecialchars($quantity[$i]).”

“;
}
}
if($joken == 1){$wwwmessage .= “

条件 [翌月]末まで下記銀行口座への振込による

“;}
if($joken == 2){$wwwmessage .= “

条件 [翌々月]末まで下記銀行口座への振込による

“;}
if($joken == 3){}
$wwwmessage.= “

非実費分合計”.htmlspecialchars($total).”

“;
$wwwmessage.= “

消費税”.htmlspecialchars($tax).”

“;
$wwwmessage.= “

(消費税は ×”.$stax.”で計算されています。)

“;
$wwwmessage.= “

実費合計”. htmlspecialchars($jippitotal).”

“;
if(!$gensenflag){$wwwmessage.= “

源泉所得税はありません。

“;}else{$wwwmessage.= “

源泉所得税”. htmlspecialchars($gensen).”

“;};
$wwwmessage.= “

請求額(振込額)”.htmlspecialchars($nyukin).”

“;
$wwwmessage.= “

“.htmlspecialchars($memo).”

“;

$wwwmessage = “

送信内容

“.$wwwmessage.”

“;

// 送信処理

mb_language(“ja”);
mb_internal_encoding(‘UTF-8’);
if(mb_send_mail($sendmailaddr, $mimeheader, $message, “From:$messagefrom”)){
echo $wwwmessage;
echo <<

請求書発行依頼メールを送信しました!

請求書発行依頼ページに戻る|トップページに戻る

END;
}else{
echo <<

申し訳ありません、メール送信で何らかのエラーが発生しました。管理者にご連絡下さい。

請求書ページに戻る|トップページに戻る

END;
}
}else{
// まだ送信じゃない

echo ‘

‘;

// echo ‘

‘;
// echo ‘

‘;

echo ‘

‘;
echo ‘

‘;

echo ‘

‘;

print <<

END;

echo $naiyou;

//送信ボタンの表示
switch($status){

default:

echo <<

備考:



END;

break;

case “phase1”:
case “phase2”:

echo <<

請求日
請求日
請求先
請求日
支払条件請求翌月末請求翌々月末それ以外(備考にご記入下さい)
※基本的には、請求日の翌月末が入金の締切に設定されます。
件名:
内容 単価 数量 小計 実費
(A)非実費分合計 $totalnote $total
(B)消費税 (A)* $stax $tax
(C)実費合計 $jippitotalnote $jippitotal
(D)源泉所得税 $gensennote $gensen
(E)振込金額 (A)+(B)+(C)-(D) $nyukin

備考:




END;

break;

}
}

?>