summaryrefslogtreecommitdiff
path: root/SOURCE/Viewer_vesy
diff options
context:
space:
mode:
Diffstat (limited to 'SOURCE/Viewer_vesy')
-rw-r--r--SOURCE/Viewer_vesy/KeyBoard.pde58
-rw-r--r--SOURCE/Viewer_vesy/LoadSetup.pde32
-rw-r--r--SOURCE/Viewer_vesy/Mouse.pde96
-rw-r--r--SOURCE/Viewer_vesy/PrintOtwes.pde122
-rw-r--r--SOURCE/Viewer_vesy/Viewer_vesy.pde182
-rw-r--r--SOURCE/Viewer_vesy/Visible.pde244
6 files changed, 734 insertions, 0 deletions
diff --git a/SOURCE/Viewer_vesy/KeyBoard.pde b/SOURCE/Viewer_vesy/KeyBoard.pde
new file mode 100644
index 0000000..e8b9700
--- /dev/null
+++ b/SOURCE/Viewer_vesy/KeyBoard.pde
@@ -0,0 +1,58 @@
+//*****************************************************
+// Работа с клавиатурой
+
+void keyReleased() {
+ if (key > 31 && key < 127 || key > 1039 && key < 1104) { // ввод данных
+ if (selectDataEdit != 0) {
+ if (inputData.length() < 30) {
+ inputData += key;
+ }
+ }
+ reset();
+ }
+
+ if (key == 8) { // backspase
+ if (inputData.length() >= 1) {
+ inputData = inputData.substring(0, inputData.length() - 1);
+ }
+ reset();
+ }
+
+ if (key == 127) { // стереть все
+ inputData = "";
+ reset();
+ }
+
+ if (key == 13 || key == 10) { // enter или return
+
+ int hCode = table.getInt(index-1, 0);
+ int hCode1 = table.getInt(index-1, 9) * 2 + table.getInt(index-1, 10) * 2 +
+ table.getInt(index-1, 12) * 2 + table.getInt(index-1, 13) * 2 +
+ table.getInt(index-1, 14) * 2 + table.getInt(index-1, 15) * 2;
+ table.setInt(index-1, 0, hCode);
+
+ if (selectDataEdit == 1) {
+ table.setInt(index-1, selectDataEdit - 1, int(inputData.trim()));
+ } else if (selectDataEdit == 14 || selectDataEdit == 15) {
+ table.setInt(index-1, selectDataEdit, int(inputData.trim()));
+ } else {
+ table.setString(index-1, selectDataEdit, inputData.trim());
+ }
+
+ if (hCode == hCode1) {
+ hCode1 = table.getInt(index-1, 9) * 2 + table.getInt(index-1, 10) * 2 +
+ table.getInt(index-1, 12)*2 +
+ table.getInt(index-1, 13)*2 + table.getInt(index-1, 14)*2 +
+ table.getInt(index-1, 15)*2;
+ table.setInt(index-1, 0, hCode1);
+ }
+
+ //saveTable(table, filePath1 + "base.csv");
+ saveTable(table, filePath + "base.csv");
+
+ selectDataEdit = 0;
+ reset();
+ inputData = "";
+ }
+ key = 0;
+}
diff --git a/SOURCE/Viewer_vesy/LoadSetup.pde b/SOURCE/Viewer_vesy/LoadSetup.pde
new file mode 100644
index 0000000..b7c4a49
--- /dev/null
+++ b/SOURCE/Viewer_vesy/LoadSetup.pde
@@ -0,0 +1,32 @@
+//*****************************************************
+// чтение файла настроек и данных
+// все настройки, клиенты, камазы и 1 взвешивания = data/
+
+void loadSetup() {
+ JSONArray values;
+
+ // Считываем путь до папки с настройками из put/sourse.json:
+ try {
+ values = loadJSONArray(put + "source.json"); // = data/ + ... // Ядиск
+ for (int i = 0; i < values.size(); i++) {
+ JSONObject animal = values.getJSONObject(i);
+ filePath = animal.getString("filePath"); // адрес папки с Ядиск
+ println(filePath);
+ }
+ }
+ catch (Exception e) {
+ printFileLog("File 'source.json' - undetected");
+ selectFolder("Select a folder to process:", "folderSelected");
+ while (!flagWork) {
+ delay(100);
+ }
+ }
+
+ values = new JSONArray();
+ JSONObject animal = new JSONObject();
+ animal.setString("filePath", filePath);
+ values.setJSONObject(0, animal);
+ saveJSONArray(values, "data/" + "source.json");
+
+ println("NEXT--->>>");
+}
diff --git a/SOURCE/Viewer_vesy/Mouse.pde b/SOURCE/Viewer_vesy/Mouse.pde
new file mode 100644
index 0000000..0eca4a1
--- /dev/null
+++ b/SOURCE/Viewer_vesy/Mouse.pde
@@ -0,0 +1,96 @@
+//****************************************************
+void mousePressed() {
+ TableRow row = table.getRow(index-1);
+ for (int i = 0; i < count; ++i) { // выбор строки
+ if ((mouseX > tablo[0]) && (mouseX < tablo[0] + tablo[2]) &&
+ (mouseY > tablo[1] + h * i) && (mouseY < tablo[1] + h + h * i)) {
+ select = i + 1;
+ reset();
+ }
+ }
+
+ if ((mouseX > tabloW[0] + shift) && (mouseX < tabloW[1] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 1;
+ inputData = row.getString(0);
+ reset();
+ }
+
+ if ((mouseX > tabloW[2] + shift) && (mouseX < tabloW[3] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 4;
+ inputData = row.getString(selectDataEdit);
+ reset();
+ }
+
+ if ((mouseX > tabloW[3] + shift) && (mouseX < tabloW[4] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 6;
+ inputData = row.getString(selectDataEdit);
+ reset();
+ }
+
+ if ((mouseX > tabloW[4] + shift) && (mouseX < tabloW[5] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 7;
+ inputData = row.getString(selectDataEdit);
+ reset();
+ }
+
+ if ((mouseX > tabloW[9] + shift) && (mouseX < tabloW[10] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 14;
+ inputData = row.getString(selectDataEdit);
+ reset();
+ }
+
+ if ((mouseX > tabloW[10] + shift) && (mouseX < tabloW[11] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 15;
+ inputData = row.getString(selectDataEdit);
+ reset();
+ }
+
+ if ((mouseX > tabloW[11] + shift) && (mouseX < tabloW[12] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ selectDataEdit = 5;
+ inputData = row.getString(selectDataEdit);
+ reset();
+ }
+
+ if ((mouseX > tabloW[13] + shift) && (mouseX < tabloW[16] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ fill(#FFFF00);
+ rect(tablo[0] + tabloW[13], s, tabloW[16] - tabloW[13], 27);
+ fill(0);
+ text("ОТВЕС", tabloW[13] + shift * 9 + tablo[0], s + 20);
+ }
+
+ if ((mouseX > tabloW[17] - 30) && (mouseX < tabloW[17]) &&
+ (mouseY > tablo[1] + tablo[3] - 8) && (mouseY < tablo[1] + tablo[3] + 12)) {
+ fill(#836FFF);
+ rect(tabloW[17] - 30, tablo[1] + tablo[3] - 8, 30, 20);
+ }
+}
+//****************************************************
+void mouseReleased() {
+ if ((mouseX > tabloW[13] + shift) && (mouseX < tabloW[16] + shift) &&
+ (mouseY > s) && (mouseY < s + 30)) {
+ //selectDataEdit = 0;
+ fill(#FF0000);
+ rect(tablo[0] + tabloW[13], s, tabloW[16] - tabloW[13], 27);
+ fill(255);
+ text("ОТВЕС", tabloW[13] + shift * 9 + tablo[0], s + 20);
+ printOtwes();
+ }
+
+ if ((mouseX > tabloW[17] - 30) && (mouseX < tabloW[17]) &&
+ (mouseY > tablo[1] + tablo[3] - 8) && (mouseY < tablo[1] + tablo[3] + 12)) {
+ fill(0);
+ rect(tabloW[17] - 30, tablo[1] + tablo[3] - 8, 30, 20);
+ select = 0;
+ selectData = 0;
+ selectDataEdit = 0;
+ reset();
+ }
+}
diff --git a/SOURCE/Viewer_vesy/PrintOtwes.pde b/SOURCE/Viewer_vesy/PrintOtwes.pde
new file mode 100644
index 0000000..a707a1e
--- /dev/null
+++ b/SOURCE/Viewer_vesy/PrintOtwes.pde
@@ -0,0 +1,122 @@
+//*****************************************************
+// Печать отвеса
+
+void printOtwes() {
+ int[] wO = {10, 73, 105, 165, 200};
+ int[] hO = {10, 55, 70, 85, 100, 115, 130};
+ String D = "";
+ String M = "";
+ String Y = "";
+ String H = "";
+ String N = "";
+ String S = "";
+ D += (day() < 10) ? "0" + day() : day();
+ M += (month() < 10) ? "0" + month() : month();
+ Y += (year() < 10) ? "0" + year() : year();
+ H += (hour() < 10) ? "0" + hour() : hour();
+ N += (minute() < 10) ? "0" + minute() : minute();
+ S += (second() < 10) ? "0" + second() : second();
+ String time1 = H + N + S;
+
+ TableRow row = table.getRow(index-1);
+
+ PGraphics pdf = createGraphics(210, 297, PDF, otwes +
+ "/" + M + "/" + D + "/" + time1 + "_" + row.getString(3) + ".pdf");
+ pdf.beginDraw();
+ pdf.background(255);
+
+ pdf.rect(wO[0], hO[0], wO[4]-wO[0], hO[1]-hO[0], 5, 5, 0, 0);
+ pdf.rect(wO[0], hO[1], wO[4]-wO[0], hO[2]-hO[1]);
+ pdf.rect(wO[0], hO[2], wO[4]-wO[0], hO[3]-hO[2]);
+ pdf.rect(wO[0], hO[3], wO[4]-wO[0], hO[4]-hO[3]);
+ pdf.rect(wO[0], hO[4], wO[4]-wO[0], hO[5]-hO[4]);
+ pdf.rect(wO[0], hO[5], wO[4]-wO[0], hO[6]-hO[5], 0, 0, 5, 5);
+
+ pdf.line(wO[1], hO[1], wO[1], hO[5]);
+ pdf.line(wO[2], hO[1], wO[2], hO[6]);
+ pdf.line(wO[3], hO[1], wO[3], hO[6]);
+
+ pdf.rect(13, 13, 40, 30, 3);
+ pdf.ellipse(40, 25, 50, 20);
+ pdf.fill(0);
+ pdf.textSize(4);
+ String k = "";
+ if (row.getInt(17) != 0) {
+ k = row.getString(11).substring(0, 5) + " [" + float(row.getString(17)) / 1000 + "]";
+ } else {
+ k = row.getString(11).substring(0, 5);
+ }
+ pdf.text(k, 17, 40);
+ pdf.textSize(6);
+ pdf.text(row.getString(1) + "/1" + M + int(random(101, 999)), 24, 27); // row.getString(2), 28, 27);
+
+ pdf.textSize(7);
+ pdf.text("Дубликат отвеса", 73, 20);
+ pdf.textSize(4);
+ pdf.text("ГосНомер а/м:", 80, 30);
+ pdf.textAlign(RIGHT);
+ pdf.textSize(8);
+ pdf.text(row.getString(3), 190, 30);
+ pdf.textAlign(LEFT);
+ pdf.textSize(4);
+ pdf.text("Сдатчик лома и отходов:", 59, 40);
+ pdf.textSize(8);
+ pdf.textAlign(RIGHT);
+ pdf.text(row.getString(4), 190, 40);
+ pdf.textAlign(LEFT);
+ pdf.textSize(3);
+ pdf.text("Бытовой лом, отходы частного строительства, или прочее..", 15, 50);
+ pdf.textAlign(RIGHT);
+ pdf.textSize(4);
+ pdf.text(row.getString(5), 190, 50);
+
+ pdf.textAlign(RIGHT);
+ pdf.textSize(5);
+ pdf.text("Брутто (т)", 70, 65);
+ pdf.text("Тара (т)", 70, 80);
+ pdf.text("Нетто (чистый вес) (т)", 70, 95);
+ pdf.text("Не принято мусора (кг)", 70, 110);
+ pdf.textAlign(LEFT);
+ pdf.text(row.getString(16), 15, 125);
+ pdf.textAlign(RIGHT);
+ pdf.textSize(6);
+ pdf.text(printData(str(row.getInt(9))), 102, 65);
+ pdf.text(printData(row.getString(12)), 102, 80);
+ //float n = row.getInt(9) - row.getInt(12) + row.getInt(17) / 2;
+ int chist = int(row.getInt(9) - row.getInt(12) - (row.getInt(9) - row.getInt(12)) /
+ 100.0 * row.getInt(7) - row.getInt(15) + row.getInt(17) / 2);
+ pdf.text(printData(str(chist)), 102, 95);
+ pdf.text(printData(row.getString(15)), 100, 110);
+
+ pdf.textAlign(RIGHT);
+ pdf.textSize(5);
+ pdf.text("Цена (руб)", 162, 65);
+ pdf.text("Процент засора (%)", 162, 80);
+ pdf.text("Стоимость (руб)", 162, 95);
+ pdf.text("Аренда КАМАЗ (руб)", 162, 110);
+ pdf.text("ИТОГО к выдаче (руб)", 162, 125);
+ pdf.textSize(6);
+ pdf.text(printData(row.getString(6)), 197, 65);
+ pdf.text(row.getString(7), 195, 80);
+ int sum = int(chist * row.getInt(6) / 1000.0);
+ pdf.text(printData(str(sum)), 197, 95);
+ pdf.text(printData(row.getString(14)), 195, 110);
+ pdf.text(printData(str(int(sum) - int(row.getString(14)))), 197, 125);
+
+ pdf.dispose();
+ pdf.endDraw();
+}
+
+//*****************************************************
+// работа над числом для вывода
+
+float workNumber(float v) {
+ if (int(v * 1000) % 10 >= 5) {
+ v = int(v * 100 + 1) / 100.0;
+ } else {
+ v = int(v * 100) / 100.0;
+ }
+ return v;
+}
+
+//*****************************************************
diff --git a/SOURCE/Viewer_vesy/Viewer_vesy.pde b/SOURCE/Viewer_vesy/Viewer_vesy.pde
new file mode 100644
index 0000000..03a6229
--- /dev/null
+++ b/SOURCE/Viewer_vesy/Viewer_vesy.pde
@@ -0,0 +1,182 @@
+//*******************************************************************
+// Zasor2 - viewer
+// 2021.03.06 - 2025.02.16
+// v. 038
+//*******************************************************************
+import processing.pdf.*;
+
+//String filePath = "data/"; // путь для сохранения копии файла базы
+//String filePath1; // путь для сохранения файла базы (Ядиск)
+String filePathLog = "LogFile.txt";
+String put = "data/"; // путь для сохранения копии файла настроек
+String filePath;
+String otwes = put + "OTWESY/"; // путь для сохранения отвесов
+int count = 0;
+int select = 0;
+int selectData = 0;
+int selectDataEdit = 0;
+int h = 17;
+int w = 80;
+int otH = 13;
+int otW = 10;
+int shift = 10;
+
+boolean flagHighlight = false;
+boolean flagWork = false;
+boolean flagBoss = false;
+boolean flagNext = false;
+
+int[] tablo = {10, 30, 1350, 900};
+int[] tabloW = {0, 40, 135, 270, 335, 370, 435, 500, 565, 630, 690,
+ 745, 955, 1035, 1110, 1185, 1270, tablo[2]};
+
+String[][] data = new String[60][20];
+String inputData = "";
+int numberReport;
+int millisOld = 0;
+
+String time, timeArh, timeMonth, timeDate, timeExc, timeReport;
+
+int index = 0;
+
+int sumN1 = 0;
+int sumN = 0;
+int sumChist = 0;
+int sumArenda = 0;
+int sumDopSor = 0;
+int sumSum = 0;
+
+int rowCount = 0;
+
+int s = tablo[1] + tablo[3] - 11;
+
+Table table;
+PFont myFont;
+
+//*****************************************************
+void settings() {
+ size(tablo[2] + 20, tablo[3] + 60);
+}
+void setup() {
+ //myFont = createFont("Arial", 12, true);
+ //textFont(myFont);
+
+ loadSetup();
+
+ //JSONArray values;
+ //values = loadJSONArray(put + "source.json");
+ //JSONObject animal = values.getJSONObject(0);
+ //filePath = animal.getString("filePath");
+ //println(filePath);
+
+ table = loadTable(filePath + "base.csv");
+ if (table == null) {
+ fill(0);
+ textSize(50);
+ text("File 'base.csv' not found !", 50, 150);
+ }
+}
+//*****************************************************
+void draw() {
+ if (millis() >= millisOld + 1000) {
+ table = loadTable(filePath + "base.csv", "header");
+ if (table.getRowCount() == rowCount) {
+ return;
+ } else {
+ rowCount = table.getRowCount();
+ fill(255);
+ rect(tablo[0], tablo[1], tablo[2], tablo[3]);
+ reset();
+ }
+ }
+}
+
+//*****************************************************
+// выбор папки с файлами:
+void folderSelected(File selection) {
+ if (selection == null) {
+ println("Window was closed or the user hit cancel.");
+ stop();
+ System.exit(1);
+ } else {
+ filePath = selection.getAbsolutePath() + "/";
+ filePath = filePath.replace("\\", "/");
+ println(filePath);
+ flagWork = true;
+ }
+}
+
+//****************************************************
+void reset() {
+ count = 0;
+ sumN1 = 0;
+ sumN = 0;
+ sumChist = 0;
+ sumArenda = 0;
+ sumDopSor = 0;
+ sumSum = 0;
+ visible();
+}
+
+//****************************************************
+String printData(String d) {
+ String d1 = "";
+ if (d.length() == 0 || d.length() == 1) {
+ d1 = "";
+ } else if (d.length() < 2) {
+ d1 = d.substring(d.length() - 1, d.length());
+ } else if (d.length() < 3) {
+ d1 = d.substring(d.length() - 2, d.length());
+ } else if (d.length() < 4) {
+ d1 = d.substring(d.length() - 3, d.length());
+ } else if (d.length() < 5) {
+ d1 = d.substring(d.length() - 4, d.length() - 3) + "'" + d.substring(d.length() - 3, d.length());
+ } else if (d.length() < 6) {
+ d1 = d.substring(d.length() - 5, d.length() - 3) + "'" + d.substring(d.length() - 3, d.length());
+ } else if (d.length() < 7) {
+ d1 = d.substring(d.length() - 6, d.length() - 3) + "'" + d.substring(d.length() - 3, d.length());
+ } else if (d.length() < 8) {
+ d1 = d.substring(d.length() - 7, d.length() - 6) + "'" + d.substring(d.length() - 6, d.length() - 3) + "'" + d.substring(d.length() - 3, d.length());
+ }
+ return d1;
+}
+
+//*****************************************************
+// вывод времени
+void TimeString() {
+ String D = "";
+ String H = "";
+ String M = "";
+ String S = "";
+ String Y = "";
+ String N = "";
+ Y += year();
+ N += (month() < 10) ? "0" + month() : month();
+ D += (day() < 10) ? "0" + day() : day();
+ H += (hour() < 10) ? "0" + hour() : hour();
+ M += (minute() < 10) ? "0" + minute() : minute();
+ S += (second() < 10) ? "0" + second() : second();
+ time = H + ":" + M + ":" + S;
+ timeArh = H + M + S;
+ timeMonth = N;
+ timeDate = D;
+ timeExc = D + "_" + H + ":" + M + ":" + S;
+ timeReport = Y + N + "_" + D;
+}
+
+//*****************************************************
+// Запись в файл лога:
+void printFileLog(String dataLog) {
+ TimeString();
+
+ String[] lines = {};
+ if (loadStrings(filePathLog) == null) {
+ saveStrings(put + filePathLog, lines);
+ lines = loadStrings(filePathLog);
+ }
+ loadStrings(filePathLog);
+ lines = append(lines, timeReport + "_" + timeArh + " vi " + dataLog);
+ saveStrings(put + filePathLog, lines);
+}
+
+//*****************************************************
diff --git a/SOURCE/Viewer_vesy/Visible.pde b/SOURCE/Viewer_vesy/Visible.pde
new file mode 100644
index 0000000..c245014
--- /dev/null
+++ b/SOURCE/Viewer_vesy/Visible.pde
@@ -0,0 +1,244 @@
+//*****************************************************
+// Отображение на экране
+
+void visible() {
+ fill(255);
+ rect(tablo[0], tablo[1], tablo[2], tablo[3] + 20);
+ for (TableRow row : table.rows()) {
+ if (count == select-1) {
+ index = row.getInt(2);
+ println(index);
+ }
+ fill(#F0FFFF);
+ if (select == count + 1) fill(#00FF00);
+ rect(tablo[0], tablo[1] + h * count, tablo[2], h);
+ rect(tablo[0] + tabloW[1], tablo[1] + h * count, tabloW[2] - tabloW[1], h);
+ rect(tablo[0] + tabloW[2], tablo[1] + h * count, tabloW[3] - tabloW[2], h);
+ rect(tablo[0] + tabloW[3], tablo[1] + h * count, tabloW[4] - tabloW[3], h);
+ rect(tablo[0] + tabloW[4], tablo[1] + h * count, tabloW[5] - tabloW[4], h);
+ rect(tablo[0] + tabloW[5], tablo[1] + h * count, tabloW[6] - tabloW[5], h);
+ rect(tablo[0] + tabloW[6], tablo[1] + h * count, tabloW[7] - tabloW[6], h);
+ rect(tablo[0] + tabloW[7], tablo[1] + h * count, tabloW[8] - tabloW[7], h);
+ rect(tablo[0] + tabloW[8], tablo[1] + h * count, tabloW[9] - tabloW[8], h);
+ rect(tablo[0] + tabloW[9], tablo[1] + h * count, tabloW[10] - tabloW[9], h);
+ rect(tablo[0] + tabloW[10], tablo[1] + h * count, tabloW[11] - tabloW[10], h);
+ rect(tablo[0] + tabloW[11], tablo[1] + h * count, tabloW[12] - tabloW[11], h);
+ rect(tablo[0] + tabloW[12], tablo[1] + h * count, tabloW[13] - tabloW[12], h);
+ rect(tablo[0] + tabloW[13], tablo[1] + h * count, tabloW[14] - tabloW[13], h);
+ rect(tablo[0] + tabloW[14], tablo[1] + h * count, tabloW[15] - tabloW[14], h);
+ rect(tablo[0] + tabloW[15], tablo[1] + h * count, tabloW[16] - tabloW[15], h);
+ rect(tablo[0] + tabloW[16], tablo[1] + h * count, tablo[2] - tabloW[16], h);
+
+ fill(0);
+ int hCode = row.getInt(0);
+ int hCode1 = row.getInt(9)*2 + row.getInt(10)*2 + row.getInt(12)*2 +
+ row.getInt(13)*2 + row.getInt(14)*2 + row.getInt(15)*2;
+ println(hCode + " - " + hCode1);
+ if (hCode != hCode1) fill(#FF0000);
+ textSize(11);
+ textAlign(RIGHT);
+ text(count + 1, tablo[1] + shift, tablo[1] + otH + h * (count));
+ text(row.getString(3), tabloW[2] - shift + tablo[0], tablo[1] + otH + h * (count));
+ text(row.getString(4), tabloW[3] - shift + tablo[0], tablo[1] + otH + h * (count));
+ text(printData(row.getString(6)), tabloW[4] - shift + tablo[0], tablo[1] + otH + h * (count));
+ text(row.getString(7), tabloW[5] - shift + tablo[0], tablo[1] + otH + h * (count));
+ text(printData(str(row.getInt(9))), tabloW[6] - shift + tablo[0], tablo[1] + otH + h * (count));
+ String q = (row.getInt(10) == 0) ? "" : row.getString(10);
+ text(q, tabloW[7] - shift + tablo[0], tablo[1] + otH + h * (count));
+ text(printData(row.getString(12)), tabloW[8] - shift + tablo[0], tablo[1] + otH + h * (count));
+ String w = (row.getInt(13) == 0) ? "" : row.getString(13);
+ text(w, tabloW[9] - shift + tablo[0], tablo[1] + otH + h * (count));
+ String e = (row.getInt(14) == 0) ? "" : row.getString(14);
+ text(printData(e), tabloW[10] - shift + tablo[0], tablo[1] + otH + h * (count));
+ String r = (row.getInt(15) == 0) ? "" : row.getString(15);
+ text(printData(r), tabloW[11] - shift + tablo[0], tablo[1] + otH + h * (count));
+ textAlign(LEFT);
+ String g;
+ if (row.getInt(17) != 0) {
+ g = "[" + row.getFloat(17) / 1000 + "] ";
+ } else {
+ g = "";
+ }
+ text(g + row.getString(5), tabloW[11] + shift + tablo[0], tablo[1] + otH + h * (count));
+ textAlign(RIGHT);
+ //int n1 = row.getInt(9) - row.getInt(10) - row.getInt(12) + row.getInt(13);
+ //text(printData(str(n1)), tabloW[13] - shift + tablo[0], tablo[1] + otH + h * (count));
+ //int n = row.getInt(9) - row.getInt(12) + row.getInt(17) / 2;
+ //text(printData(str(n)), tabloW[14] - shift + tablo[0], tablo[1] + otH + h * (count));
+ int chist = int(row.getInt(9) - row.getInt(12) - (row.getInt(9) - row.getInt(12)) / 100.0 *
+ row.getInt(7) - row.getInt(15) + row.getInt(17) / 2);
+ text(printData(str(int(chist))), tabloW[15] - shift + tablo[0], tablo[1] + otH + h * (count));
+ int sum = chist * row.getInt(6) / 1000;
+ text(printData(str(sum)), tabloW[16] - shift + tablo[0], tablo[1] + otH + h * (count));
+ text(row.getString(11), tabloW[17] - shift + tablo[0], tablo[1] + otH + h * (count));
+
+ int sum1 = chist * row.getInt(6) / 1000 - row.getInt(14);
+ text(printData(str(sum1)), tabloW[13] - shift + tablo[0], tablo[1] + otH + h * (count));
+
+ //sumN1 += n1;
+ //sumN += n;
+ sumChist += chist;
+ sumArenda += row.getInt(14);
+ sumDopSor += row.getInt(15);
+ sumSum += sum;
+
+ count++;
+ }
+
+ //String[] kamazy = loadStrings(filePath1 + "kamazy.txt");
+ //println("File 'kamazy.txt' found !");
+ //int sumKamazy = 0;
+ //int sumKamEach = 0;
+ //for (int k = 0; k < kamazy.length; ++k) {
+ // for (TableRow row : table.findRows(kamazy[k], "nomer")) {
+ // sumKamEach += row.getInt(9) - row.getInt(12) - int((row.getInt(9) -
+ // row.getInt(12)) / 100.0 * row.getInt(7)) - row.getInt(15) + row.getInt(17);
+ // }
+ // sumKamazy += sumKamEach;
+ // sumKamEach = 0;
+ //}
+
+
+ fill(#FFF0F5);
+ rect(tablo[0] + tabloW[0], tablo[1] - 30, tabloW[1] - tabloW[0], h + shift);
+ rect(tablo[0] + tabloW[1], tablo[1] - 30, tabloW[2] - tabloW[1], h + shift);
+ rect(tablo[0] + tabloW[2], tablo[1] - 30, tabloW[3] - tabloW[2], h + shift);
+ rect(tablo[0] + tabloW[3], tablo[1] - 30, tabloW[4] - tabloW[3], h + shift);
+ rect(tablo[0] + tabloW[4], tablo[1] - 30, tabloW[5] - tabloW[4], h + shift);
+ rect(tablo[0] + tabloW[5], tablo[1] - 30, tabloW[6] - tabloW[5], h + shift);
+ rect(tablo[0] + tabloW[6], tablo[1] - 30, tabloW[7] - tabloW[6], h + shift);
+ rect(tablo[0] + tabloW[7], tablo[1] - 30, tabloW[8] - tabloW[7], h + shift);
+ rect(tablo[0] + tabloW[8], tablo[1] - 30, tabloW[9] - tabloW[8], h + shift);
+ rect(tablo[0] + tabloW[9], tablo[1] - 30, tabloW[10] - tabloW[9], h + shift);
+ rect(tablo[0] + tabloW[10], tablo[1] - 30, tabloW[11] - tabloW[10], h + shift);
+ rect(tablo[0] + tabloW[11], tablo[1] - 30, tabloW[12] - tabloW[11], h + shift);
+ rect(tablo[0] + tabloW[12], tablo[1] - 30, tabloW[13] - tabloW[12], h + shift);
+ rect(tablo[0] + tabloW[13], tablo[1] - 30, tabloW[14] - tabloW[13], h + shift);
+ rect(tablo[0] + tabloW[14], tablo[1] - 30, tabloW[15] - tabloW[14], h + shift);
+ rect(tablo[0] + tabloW[15], tablo[1] - 30, tabloW[16] - tabloW[15], h + shift);
+ rect(tablo[0] + tabloW[16], tablo[1] - 30, tablo[2] - tabloW[16], h + shift);
+ textSize(14);
+
+ //rect(tablo[0] + tabloW[8], tablo[1] + h * count, tabloW[9] - tabloW[8], h * 2);
+ rect(tablo[0] + tabloW[9], tablo[1] + h * count, tabloW[10] - tabloW[9], h * 2);
+ rect(tablo[0] + tabloW[10], tablo[1] + h * count, tabloW[11] - tabloW[10], h * 2);
+ rect(tablo[0] + tabloW[11], tablo[1] + h * count, tabloW[12] - tabloW[11], h * 2);
+ rect(tablo[0] + tabloW[12], tablo[1] + h * count, tabloW[13] - tabloW[12], h * 2);
+ rect(tablo[0] + tabloW[13], tablo[1] + h * count, tabloW[14] - tabloW[13], h * 2);
+ rect(tablo[0] + tabloW[14], tablo[1] + h * count, tabloW[15] - tabloW[14], h * 2);
+ rect(tablo[0] + tabloW[15], tablo[1] + h * count, tabloW[16] - tabloW[15], h * 2);
+ rect(tablo[0] + tabloW[16], tablo[1] + h * count, tablo[2] - tabloW[16], h * 2);
+
+ fill(0);
+ rect(tabloW[17] - 30, tablo[1] + tablo[3] - 8, 30, 20);
+
+ fill(0);
+ textSize(14);
+ textAlign(LEFT);
+ text("№", tabloW[0] + tablo[0] + shift + 5, tablo[1] - otH);
+ text("Номер", tabloW[1] + tablo[0] + shift + 15, tablo[1] - otH);
+ text("Клиент", tabloW[2] + tablo[0] + shift + 30, tablo[1] - otH);
+ text("Цена", tabloW[3] + tablo[0] + shift + 5, tablo[1] - otH);
+ text("%", tabloW[4] + tablo[0] + shift + 5, tablo[1] - otH);
+ text("Вес 1", tabloW[5] + tablo[0] + shift + 5, tablo[1] - otH);
+ text("z21", tabloW[6] + tablo[0] + shift + 10, tablo[1] - otH);
+ text("Вес 2", tabloW[7] + tablo[0] + shift + 5, tablo[1] - otH);
+ text("z22", tabloW[8] + tablo[0] + shift + 10, tablo[1] - otH);
+ text("Камаз", tabloW[9] + tablo[0] + shift, tablo[1] - otH);
+ text("ДС", tabloW[10] + tablo[0] + shift + 8, tablo[1] - otH);
+ text("Объект", tabloW[11] + tablo[0] + shift + 60, tablo[1] - otH);
+ text("К выдаче", tabloW[12] + tablo[0] + shift, tablo[1] - otH);
+ //text("H1", tabloW[12] + tablo[0] + shift * 3, tablo[1] - otH);
+ //text("Н", tabloW[13] + tablo[0] + shift * 3, tablo[1] - otH);
+ text("Чистый", tabloW[14] + tablo[0] + shift + 5, tablo[1] - otH);
+ text("Сумма", tabloW[15] + tablo[0] + shift + 10, tablo[1] - otH);
+ text("Время 2", tabloW[16] + tablo[0] + shift + 5, tablo[1] - otH);
+
+ textAlign(RIGHT);
+ //text("" + workNumber(sumKamazy / 1000.0), tabloW[9] + shift - 5, tablo[1] + h * count + 25);
+ text("" + workNumber(sumArenda / 1000.0), tabloW[10] + shift - 5, tablo[1] + h * count + 25);
+ text("" + workNumber(sumDopSor / 1000.0), tabloW[11] + shift - 5, tablo[1] + h * count + 25);
+ textAlign(LEFT);
+ //float w = workNumber((sumN1 - sumChist) / float(sumN1) * 10000 / 100.0);
+ //float w1 = workNumber((sumN - sumChist - sumDopSor) / float(sumN) * 100);
+ //text(" " + w1 + " / " + workNumber((sumN1 - sumN) / 1000.0) + " / " + w, tabloW[11] +
+ //shift * 2, tablo[1] + h * count + 25);
+ textAlign(RIGHT);
+ //text("" + (sumN1) / 1000.0, tabloW[13] + shift - 5, tablo[1] + h * count + 25);
+ //text("" + (sumN) / 1000.0, tabloW[14] + shift - 5, tablo[1] + h * count + 25);
+ text("" + int(sumChist / 1000.0 * 100) / 100.0, tabloW[15] + shift - 5, tablo[1] + h * count + 25);
+ text("" + int(sumSum / 1000.0 * 100) / 100.0, tabloW[16] + shift - 5, tablo[1] + h * count + 25);
+ text("" + printData(str(int(float(sumSum) / sumChist * 1000))), tabloW[17] - 10, tablo[1] + h * count + 25);
+
+ if (select != 0) {
+ fill(#F0FFF0);
+ if (selectDataEdit == 1) fill(#1E90FF);
+ rect(tablo[0] + tabloW[1], s, tabloW[0] - tabloW[1], h + shift);
+ fill(#F0FFF0);
+ if (selectDataEdit == 4) fill(#1E90FF);
+ rect(tablo[0] + tabloW[2], s, tabloW[3] - tabloW[2], h + shift);
+ fill(#F0FFF0);
+ if (selectDataEdit == 6) fill(#1E90FF);
+ rect(tablo[0] + tabloW[3], s, tabloW[4] - tabloW[3], h + shift);
+ fill(#F0FFF0);
+ if (selectDataEdit == 7) fill(#1E90FF);
+ rect(tablo[0] + tabloW[4], s, tabloW[5] - tabloW[4], h + shift);
+ fill(#F0FFF0);
+ if (selectDataEdit == 14) fill(#1E90FF);
+ rect(tablo[0] + tabloW[9], s, tabloW[10] - tabloW[9], h + shift);
+ fill(#F0FFF0);
+ if (selectDataEdit == 15) fill(#1E90FF);
+ rect(tablo[0] + tabloW[10], s, tabloW[11] - tabloW[10], h + shift);
+ fill(#F0FFF0);
+ if (selectDataEdit == 5) fill(#1E90FF);
+ rect(tablo[0] + tabloW[11], s, tabloW[12] - tabloW[11], h + shift);
+
+ fill(#FF3030);
+ rect(tablo[0] + tabloW[13], s, tabloW[16] - tabloW[13], h + shift);
+
+ fill(#FF0000);
+ textSize(14);
+
+ TableRow row = table.getRow(index-1);
+
+ if (selectDataEdit == 4) {
+ text(inputData, tabloW[3] - shift + tablo[0], s + shift * 2);
+ } else {
+ text(row.getString(4), tabloW[3] - shift + tablo[0], s + shift * 2);
+ }
+ if (selectDataEdit == 6) {
+ text(inputData, tabloW[4] - shift + tablo[0], s + shift * 2);
+ } else {
+ text(row.getString(6), tabloW[4] - shift + tablo[0], s + shift * 2);
+ }
+ if (selectDataEdit == 7) {
+ text(inputData, tabloW[5] - shift + tablo[0], s + shift * 2);
+ } else {
+ text(row.getString(7), tabloW[5] - shift + tablo[0], s + shift * 2);
+ }
+ if (selectDataEdit == 14) {
+ text(inputData, tabloW[10] - shift + tablo[0], s + shift * 2);
+ } else {
+ text(row.getInt(14), tabloW[10] - shift + tablo[0], s + shift * 2);
+ }
+ if (selectDataEdit == 15) {
+ text(inputData, tabloW[11] - shift + tablo[0], s + shift * 2);
+ } else {
+ text(row.getInt(15), tabloW[11] - shift + tablo[0], s + shift * 2);
+ }
+
+ textAlign(LEFT);
+ if (selectDataEdit == 5) {
+ text(inputData, tabloW[11] + shift + tablo[0], s + shift * 2);
+ } else {
+ text(row.getString(5), tabloW[11] + shift + tablo[0], s + shift * 2);
+ }
+
+ fill(255);
+ text("ОТВЕС", tabloW[13] + shift * 9 + tablo[0], s + shift * 2);
+ }
+
+ millisOld = millis();
+}
+
+//*****************************************************