Skip to content

Commit

Permalink
stoklu girislerde bulunan miktar alani icin kusuratli girislere izin …
Browse files Browse the repository at this point in the history
…verildi, closes #18.

cari tanitim formunda bulunan TC Kimlik No alani icin 11 hane veri girisine izin verildi, closes #17.
  • Loading branch information
mdpinar committed Feb 3, 2015
1 parent e5f6f59 commit f9dfcfd
Show file tree
Hide file tree
Showing 41 changed files with 153 additions and 124 deletions.
14 changes: 9 additions & 5 deletions app/controllers/invoice/Transes.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import models.InvoiceTransDetail;
import models.InvoiceTransFactor;
import models.InvoiceTransTax;
import models.Safe;
import models.SaleSeller;
import models.Stock;
import models.search.OrderTransSearchParam;
Expand Down Expand Up @@ -189,10 +190,8 @@ public static Result save(RightBind rightBind) {
model.excEquivalent = model.netTotal;

if (model.isCash) {
if (model.refModule == null || ! model.refModule.equals(Module.safe)) {
model.refModule = Module.safe;
model.refSafe = Profiles.chosen().gnel_safe;
}
model.refModule = Module.safe;
if (model.refSafe == null || model.refSafe.id == null) model.refSafe = Safe.findById(1);
model.refExcCode = model.excCode;
model.refExcRate = model.excRate;
model.refExcEquivalent = model.excEquivalent;
Expand Down Expand Up @@ -325,7 +324,12 @@ public static Result save(RightBind rightBind) {
return badRequest(form.render(filledForm, rightBind, InvoiceTransRows.build(model)));
}

if (Profiles.chosen().stok_isRowCombining) doRowCombining(model);
if (Profiles.chosen().stok_isRowCombining) {
doRowCombining(model);
for (int i = 0; i < model.details.size(); i++) {
model.details.get(i).rowNo = i + 1;
}
}

String res = RefModuleUtil.save(model, Module.invoice, model.contact);
if (res != null) {
Expand Down
3 changes: 3 additions & 0 deletions app/db/migration/V1_0_0__Create_Tables.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public void migrate(Connection con) throws Exception {
log.error("ERROR : " + fileName + " not found!!!");
return;
} else {

GlobalCons.isInitScriptExecuted = true;

log.info("DB migrations are executing for : " + fileName);

BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(initFile), Charsets.UTF_8));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,37 @@

import com.googlecode.flyway.core.api.migration.jdbc.JdbcMigration;

/**
* Contact tablosudaki 'TC Kimlik No' alani version 1.0.4 ten once int tipindeydi,
* bu sinif ile varchar(11) tipine cevrildi.
*
* @author mdpinar
*/

public class V1_0_4__Changing_TC_No_data_type_in_Contact_table implements JdbcMigration {

private final static Logger log = LoggerFactory.getLogger(V1_0_4__Changing_TC_No_data_type_in_Contact_table.class);

@Override
public void migrate(Connection con) throws Exception {
log.info("Altering Contact table for TC No field type changing...");

Statement sta = con.createStatement();
sta.executeUpdate("alter table contact add column tc varchar(11)");
sta.executeUpdate("update contact set tc = tc_kimlik");
sta.executeUpdate("alter table contact drop column tc_kimlik");

if (GlobalCons.dbVendor.equals("mysql")) {
sta.executeUpdate("alter table contact change tc tc_kimlik varchar(11)");
} else if (GlobalCons.dbVendor.equals("mssql")) {
sta.executeUpdate("EXEC sp_rename 'tc', 'tc_kimlik_no', 'COLUMN';");
} else {
sta.executeUpdate("alter table contact rename column tc to tc_kimlik");
log.info("Altering Contact table for TC No field type is executing...");

if (! GlobalCons.isInitScriptExecuted) {
Statement sta = con.createStatement();
sta.executeUpdate("alter table contact add column tc varchar(11)");
sta.executeUpdate("update contact set tc = tc_kimlik");
sta.executeUpdate("alter table contact drop column tc_kimlik");

if (GlobalCons.dbVendor.equals("mysql")) {
sta.executeUpdate("alter table contact change tc tc_kimlik varchar(11)");
} else if (GlobalCons.dbVendor.equals("mssql")) {
sta.executeUpdate("EXEC sp_rename 'tc', 'tc_kimlik_no', 'COLUMN';");
} else {
sta.executeUpdate("alter table contact rename column tc to tc_kimlik");
}
}

log.info("Contact table has altered.");
log.info("Contact table has been altered.");
}

}
2 changes: 1 addition & 1 deletion app/html/trans_form_rows/InvoiceTransRows.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static String build(InvoiceTrans invoiceTrans) {
row.append("</td>");

row.append("<td>");
row.append("<input type='text' class='number attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("<input type='text' class='amount attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("</td>");

row.append("<td>");
Expand Down
2 changes: 1 addition & 1 deletion app/html/trans_form_rows/OrderTransRows.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static String build(OrderTrans orderTrans) {
row.append("</td>");

row.append("<td>");
row.append("<input type='text' class='number attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("<input type='text' class='amount attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("</td>");

row.append("<td>");
Expand Down
2 changes: 1 addition & 1 deletion app/html/trans_form_rows/StockTransRows.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static String build(StockTrans stockTrans) {
row.append("</td>");

row.append("<td>");
row.append("<input type='text' class='number attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("<input type='text' class='amount attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("</td>");

row.append("<td>");
Expand Down
2 changes: 1 addition & 1 deletion app/html/trans_form_rows/WaybillTransRows.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static String build(WaybillTrans waybillTrans) {
row.append("</td>");

row.append("<td>");
row.append("<input type='text' class='number attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("<input type='text' class='amount attention stocks' id='details["+i+"]_quantity' name='details["+i+"].quantity' value='"+detail.quantity+"' style='width:calc(100% - 5px);' />");
row.append("</td>");

row.append("<td>");
Expand Down
3 changes: 2 additions & 1 deletion app/models/Contact.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public class Contact extends BaseContactExtraFieldsModel {
@Constraints.MaxLength(15)
public String taxNumber;

public Integer tcKimlik;
@Constraints.MaxLength(11)
public String tcKimlik;

@Constraints.MaxLength(30)
public String relevant;
Expand Down
7 changes: 7 additions & 0 deletions app/models/InvoiceTrans.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ public void delete() {
super.delete();
}

@Override
public void singleDelete() {
deleteStockTrans(true);
super.singleDelete();
}

@Override
public void save() {
super.save();
Expand Down Expand Up @@ -320,6 +326,7 @@ private void addStockTrans() {
stockDet.seller = detail.seller;
stockDet.transPoint = detail.transPoint;
stockDet.privateCode = detail.privateCode;
stockDet.rowNo = detail.rowNo;
stockDet.name = detail.name;
stockDet.quantity = detail.quantity;
stockDet.unit = detail.unit;
Expand Down
2 changes: 2 additions & 0 deletions app/utils/GlobalCons.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class GlobalCons {
public static String defaultExcCode;
public static String TRUE;
public static String FALSE;

public static boolean isInitScriptExecuted = false;

static {
Configuration conf = Play.application().configuration();
Expand Down
2 changes: 1 addition & 1 deletion conf/evolutions/h2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ create table contact (
name varchar(100) not null,
tax_office varchar(20),
tax_number varchar(15),
tc_kimlik int,
tc_kimlik varchar(11),
relevant varchar(30),
phone varchar(15),
fax varchar(15),
Expand Down
2 changes: 1 addition & 1 deletion conf/evolutions/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ create table contact (
name varchar(100) not null,
tax_office varchar(20),
tax_number varchar(15),
tc_kimlik int,
tc_kimlik varchar(11),
relevant varchar(30),
phone varchar(15),
fax varchar(15),
Expand Down
2 changes: 1 addition & 1 deletion conf/evolutions/postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ create table contact (
name varchar(100) not null,
tax_office varchar(20),
tax_number varchar(15),
tc_kimlik integer,
tc_kimlik varchar(11),
relevant varchar(30),
phone varchar(15),
fax varchar(15),
Expand Down
2 changes: 1 addition & 1 deletion conf/evolutions/sqlserver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ create table contact (
name varchar(100) not null,
tax_office varchar(20),
tax_number varchar(15),
tc_kimlik bigint,
tc_kimlik varchar(11),
relevant varchar(30),
phone varchar(15),
fax varchar(15),
Expand Down
1 change: 1 addition & 0 deletions public/javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function updateFormRegulators(selector) {
try {
$((selector ? selector : "") + " .currency").autoNumeric({lZero: 'deny', aSep:'', mDec: pennyDigits});
$((selector ? selector : "") + " .rate").autoNumeric({lZero: 'keep', aSep:'', vMin: '-99.99', vMax: '100', aPad: false});
$((selector ? selector : "") + " .amount").autoNumeric({lZero: 'keep', aSep:'', vMin: '0', mDec: '5', aPad: false});
$((selector ? selector : "") + " .number").autoNumeric({lZero: 'deny', aSep:'', mDec:'0'});

$((selector ? selector : "") + " .date").inputmask("dd/mm/yyyy", {clearIncomplete: true, placeholder: "", yearrange: {minyear: 2000, maxyear: 2099}});
Expand Down
2 changes: 1 addition & 1 deletion public/stylesheets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ input[disabled], select[disabled], textarea[disabled], input[readonly], select[r
width: 157px;
}

.number, .currency, .rate, .to-right {
.number, .currency, .amount, .rate, .to-right {
text-align: right;
}

Expand Down
10 changes: 5 additions & 5 deletions reports/invoice/InvoiceListDetailed.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{tax_amount}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="455" y="1" width="20" height="13" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -697,7 +697,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{discount_amount}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="475" y="1" width="20" height="13" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -723,7 +723,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{dettot}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="536" y="1" width="20" height="13" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -749,7 +749,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{exc_code}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="435" y="1" width="20" height="13" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -775,7 +775,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{price}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="276" y="1" width="41" height="13" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand Down
10 changes: 5 additions & 5 deletions reports/order/DistReportStockBasedDetailed.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ order by s.name, t.trans_date, t.trans_type]]>
</columnHeader>
<detail>
<band height="15">
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="238" y="0" width="40" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand Down Expand Up @@ -553,7 +553,7 @@ order by s.name, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[str("enum." + $F{_right})]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="398" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -566,7 +566,7 @@ order by s.name, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{discount_rate1}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="418" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -579,7 +579,7 @@ order by s.name, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{discount_rate2}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="438" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -592,7 +592,7 @@ order by s.name, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{discount_rate3}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="500" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand Down
10 changes: 5 additions & 5 deletions reports/order/DistReportStockBasedSummary.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{code}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="448" y="0" width="41" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -277,7 +277,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{max_limit}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="317" y="0" width="45" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -290,7 +290,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[($F{completed_sum} != null ? $F{completed_sum}.doubleValue() : 0)]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="407" y="0" width="41" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -303,7 +303,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{min_limit}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="489" y="0" width="45" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -329,7 +329,7 @@ $P!{ORDER_BY}]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[($F{quantity_sum} != null ? $F{quantity_sum}.doubleValue() : 0)]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="362" y="0" width="45" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand Down
8 changes: 4 additions & 4 deletions reports/order/DistReportXBasedDetailed.jrxml
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ order by $P!{GROUP_FIELD}, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.util.Date"><![CDATA[$F{trans_date}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="443" y="0" width="40" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand Down Expand Up @@ -503,7 +503,7 @@ order by $P!{GROUP_FIELD}, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[str("enum." + $F{_right})]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="603" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -516,7 +516,7 @@ order by $P!{GROUP_FIELD}, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{discount_rate1}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="623" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand All @@ -529,7 +529,7 @@ order by $P!{GROUP_FIELD}, t.trans_date, t.trans_type]]>
</textElement>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{discount_rate2}]]></textFieldExpression>
</textField>
<textField pattern="###0.##" isBlankWhenNull="true">
<textField isBlankWhenNull="true">
<reportElement key="textField-5" x="643" y="0" width="20" height="15" isPrintWhenDetailOverflows="true"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
Expand Down
Loading

0 comments on commit f9dfcfd

Please sign in to comment.