Changeset 326 for trunk/finance
- Timestamp:
- Dec 13, 2011, 9:13:03 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/finance/import.php
r325 r326 26 26 } 27 27 28 function InsertMoney($Subject, $Value, $Cash, $Taxable, $Time, $Text, $DocumentLine)29 {30 31 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine);32 $this->Database->insert('FinanceOperation', array('Text' => $Text, 'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode));33 }34 35 28 function Prepare() 36 29 { … … 73 66 $Automatic = ''; 74 67 $Manual = ''; 75 $Output .= '<form action="?Operation=insert" method="post">';68 $Output = '<form action="?Operation=insert" method="post">'; 76 69 $I = 0; 77 70 foreach($Data as $Key => $Value) … … 79 72 if(count($Value) <= 1) continue; 80 73 if($Value[9] == '') $Value[5] = 128; // Žádný účet => Poštovní spořitelna 74 $Time = explode('.', $Value[0]); 75 $Time = $Time[2].'-'.$Time[1].'-'.$Time[0]; 76 $Money = $Value[1]; 81 77 if(is_numeric($Value[5])) 82 78 { 83 $Time = explode('.', $Value[0]);84 $Time = $Time[2].'-'.$Time[1].'-'.$Time[0];85 $Money = $Value[1];86 79 $Subject = $Value[5] * 1; 87 $Automatic .= '<tr>'. 88 '<td>Automaticky</td>'. 80 $DbResult = $this->Database->query('SELECT Id FROM Subject WHERE Id='.$this->Database->real_escape_string($Subject)); 81 if($DbResult->num_rows == 0) $Subject = '? ('.($Value[5] * 1).')'; 82 } else 83 { 84 $Subject = '? ('.$Value[5].')'; 85 } 86 if(!is_numeric($Subject)) 87 { 88 $Mode = 'Ručně'; 89 $Style = 'style="background-color: LightPink;" '; 90 } else 91 { 92 $Mode = 'Automaticky'; 93 $Style = ''; 94 } 95 96 if($Money < 0) $Text = 'Platba převodem'; 97 else $Text = 'Přijatá platba'; 98 $Automatic .= '<tr>'. 99 //'<td>'.$Mode.'</td>'. 89 100 '<td><input type="text" name="Date'.$I.'" value="'.$Time.'"/></td>'. 90 '<td><input type="text" name="Subject'.$I.'" value="'.$Subject.'"/></td>'.101 '<td><input type="text" '.$Style.'name="Subject'.$I.'" value="'.$Subject.'"/></td>'. 91 102 '<td>'.$Value[8].'</td>'. 92 103 '<td><input type="text" name="Money'.$I.'" value="'.$Money.'"/></td>'. 93 '<td><input type="text" name="Text'.$I.'" value=" Vklad"/></td>'.104 '<td><input type="text" name="Text'.$I.'" value="'.$Text.'"/></td>'. 94 105 '<td><input type="text" name="Taxable'.$I.'" value="1"/></td>'. 95 106 '<td><input type="text" name="Network'.$I.'" value="1"/></td>'. 96 107 '</tr><tr><td colspan="7">'.implode(', ', $Value).'</td></tr>'; 97 } else98 {99 $Time = explode('.', $Value[0]);100 $Time = $Time[2].'-'.$Time[1].'-'.$Time[0];101 $Money = $Value[1];102 $Subject = '?';103 $Automatic .= '<tr>'.104 '<td>Ručně</td>'.105 '<td><input type="text" name="Date'.$I.'" value="'.$Time.'"/></td>'.106 '<td><input type="text" name="Subject'.$I.'" value="'.$Subject.'"/></td>'.107 '<td>'.$Value[8].'</td>'.108 '<td><input type="text" name="Money'.$I.'" value="'.$Money.'"/></td>'.109 '<td><input type="text" name="Text'.$I.'" value="Vklad"/></td>'.110 '<td><input type="text" name="Taxable'.$I.'" value="1"/></td>'.111 '<td><input type="text" name="Network'.$I.'" value="1"/></td>'.112 '</tr><tr><td colspan="7">'.implode(', ', $Value).'</td></tr>';113 }114 108 $I++; 115 109 } 116 110 $Output .= '<table class="WideTable">'. 117 '<tr><th>Zpracování</th><th>Datum</th><th>Var. symbol</th><th>Protiúčet</th><th>Částka [Kč]</th><th>Text</th><th>Zdanitelné</th><th>Síť</th></tr>'; 111 '<tr>'. 112 //'<th>Zpracování</th>'. 113 '<th>Datum</th><th>Var. symbol</th><th>Protiúčet</th><th>Částka [Kč]</th><th>Text</th><th>Zdanitelné</th><th>Síť</th></tr>'; 118 114 $Output .= $Automatic.'</table>'; 119 115 $Output .= '<input type="hidden" name="ItemCount" value="'.$I.'"/>'; … … 123 119 } 124 120 121 function InsertMoney($Subject, $Value, $Cash, $Taxable, $Time, $Text, $DocumentLine) 122 { 123 124 $BillCode = $this->System->Modules['Finance']->GetNextDocumentLineNumber($DocumentLine); 125 $this->Database->insert('FinanceOperation', array('Text' => $Text, 'Subject' => $Subject, 'Cash' => $Cash, 'Value' => $Value, 'Time' => TimeToMysqlDateTime($Time), 'Taxable' => $Taxable, 'BillCode' => $BillCode)); 126 } 127 125 128 function Insert() 126 129 { … … 128 131 $Output = ''; 129 132 130 for($I = 0; $I < $_POST['ItemCount']; $I++)133 for($I = $_POST['ItemCount'] - 1; $I >= 0 ; $I--) 131 134 { 132 135 if($_POST['Money'.$I] < 0) $DocumentLine = 4; 133 136 else $DocumentLine = 3; 134 $this->InsertMoney($_POST['Subject'.$I], $_POST['Money'.$I], 0, $_POST['Taxable'.$I], $_POST['Date'.$I], $_POST['Text'.$I], $DocumentLine); 137 $Date = explode('-', $_POST['Date'.$I]); 138 $Date = mktime(0, 0, 0, $Date[1], $Date[2], $Date[0]); 139 $this->InsertMoney($_POST['Subject'.$I], $_POST['Money'.$I], 0, $_POST['Taxable'.$I], $Date, $_POST['Text'.$I], $DocumentLine); 135 140 $Output .= $I.', '; 136 141 $this->System->Modules['Log']->NewRecord('Finance', 'NewPaymentInserted');
Note:
See TracChangeset
for help on using the changeset viewer.