51

(38 replies, posted in Russian)

Спасибо большое. Работает отлично. Есть только одна проблема. Покажу на примере.
Программа выдает вот это:

                       i1              i2            i3             i4              i5
01.01.17      4               1               2              1               3
02.01.17      4               2               0              1               6
03.01.17      4               1               1              1               4
04.01.17      4               3               0              1               7
и т.д.

В i1 показывается все работники которые остались (i5) до даты DateTimePicker1
В i2 показывается все работники которые пришли между датами DateTimePicker1 и DateTimePicker2 включительно
В i3 показывается все работники которые ушли между датами DateTimePicker1 и DateTimePicker2 включительно
i4 не объязателен можете не учитывать
i5 = i1+i2-i3

В примере все идет отлично, проблема в том что 1-го числа осталось работников 3 (i5).
В 02.01.17 в пункте i1 должно быть 3, т.е. i5 предыдущего дня. В общем пример должен выглядит так:

                       i1              i2            i3             i4              i5
01.01.17      4               1               2              1               3
02.01.17      3               2               0              1               5
03.01.17      5               1               1              1               5
04.01.17      5               3               0              1               8
и т.д.

Как быть?

52

(38 replies, posted in Russian)

DriveSoft wrote:

Увы не смогу помочь, ваш проект не соотвествует вопросу, нет такой формы и компонентов

На форме Fond имеется DateTimePicker1 и 2, Button1, TGrid, ostatok (TextBox), omad (TextBox), raft (TextBox), favt (TextBox) и mond (TextBox).

Исправлен

53

(38 replies, posted in Russian)

вместо него можете использовать idemployee это тот же numberTB

54

(38 replies, posted in Russian)

DriveSoft wrote:

Приложите пожалуйста ваш проект, с тестовыми данными, постараюсь помочь.

55

(38 replies, posted in Russian)

Если в грид нельзя то можно и в Memo, помогите с реализацией пожалуйста, или подталкните как это сделать.

56

(3 replies, posted in General)

yes, calculation is done when there is any digit or value so you have to show in the script if there is any number less or more than 0.

57

(3 replies, posted in General)

Change this script:

procedure CalculateTotal;
var
  WinPercent, LossPercent: Real;
  WinPercent2, LossPercent2: Real;

begin
  WinPercent:= Form1.edWinPercent.value;
  LossPercent:= Form1.edLossPercent.Value;
  WinPercent2:= Form1.edWinPercent2.value;
  LossPercent2:= Form1.edLossPercent2.Value;

    begin
    if (Form1.edWinCount.Value <> 0) and (Form1.edLossCount.Value <> 0) then
    begin
          Form1.edWinPercent.Value := Form1.edWinCount.value / (Form1.edWinCount.value + Form1.edLossCount.value) * 100;
          Form1.edLossPercent.Value := Form1.edLossCount.value / (Form1.edWinCount.value + Form1.edLossCount.value) * 100;
    end;

    if (Form1.edWinCount2.Value <> 0) and (Form1.edLossCount2.Value <> 0) then
    begin
    Form1.edWinPercent2.Value := Form1.edWinCount2.value / (Form1.edWinCount2.value + Form1.edLossCount2.value) * 100;
    Form1.edLossPercent2.Value := Form1.edLossCount2.value / (Form1.edWinCount2.value + Form1.edLossCount2.value) * 100;
    end;
end;
end;

58

(11 replies, posted in Russian)

Уважаемый Дмитрий!
Как добавить к программе RegExp функции найти, найти все, заменить на и заменить все на?

59

(38 replies, posted in Russian)

Уважаемый Дмитрий!

На форме Fond имеется DateTimePicker1 и 2, Button1, TGrid, ostatok (TextBox), omad (TextBox), raft (TextBox), favt (TextBox) и mond (TextBox).
Есть такая вот процедура.

procedure Fond_Button1_OnClick (Sender: string; var Cancel: boolean);
var
i1, i2, i3, i4: integer;
begin
      i1:= SQLExecute('Select Count(numberTB) from Base where incomeDate < '+Fond.DateTimePicker1.sqlDateTime+' and outcomeDate Between '+Fond.DateTimePicker1.sqlDateTime +' and '+Fond.DateTimePicker2.sqlDateTime +'');
      Fond.ostatok.Value:= i1;
      i2:= SQLExecute('Select Count(numberTB) from Base where incomeDate Between '+Fond.DateTimePicker1.sqlDateTime+' and '+Fond.DateTimePicker2.sqlDateTime +'');
      Fond.omad.Value:= i2;
      i3:= SQLExecute('Select Count(numberTB) from Base where outcomeDate Between '+Fond.DateTimePicker1.sqlDateTime+' and '+Fond.DateTimePicker2.sqlDateTime +'');
      Fond.raft.Value:= i3;
      i4:= SQLExecute('Select Count(numberTB) from Base where outcomeDate Between '+Fond.DateTimePicker1.sqlDateTime+' and '+Fond.DateTimePicker2.sqlDateTime +' and Base.id_endoftreatment=2');
      Fond.favt.Value:= i4;
      i5:= i1 + i2 - i3;
      Fond.mond.Value:= i5;
end;

Теперь при указании даты в пикерах 1 и 2 все работает отлично. Например я указываю 01.01.2017 и 31.01.17 и в указанных текстбоксах все калькулируется нормально но с учетом всего месяца.
Как мне сделать чтобы в грид добавилась строка и показывались i1, i2, i3, i4 и i5 на каждый день. Т.е. я указываю 01.01.2017 и 31.01.17 и в грид показывается типа вот так:

01.01.17      i1          i2        i3      i4     i5
02.01.17      i1          i2        i3      i4     i5
03.01.17      i1          i2        i3      i4     i5
...
31.01.17      i1          i2        i3      i4     i5

Надо подчеркнуть что i5 сегодняшнего дня всегда равняется i1 следующего дня. Т.е. если привести примеры в виде цифр то должно получится типа вот так:

                  i1          i2        i3      i4     i5
01.01.17      4           2         3      2     3
02.01.17      3           2         1      3     4
03.01.17      4           1         0      1     5
...
31.01.17      2           2         1      0     3

Помогите с реализацией пожалуйста.

60

(6 replies, posted in General)

AD1408 wrote:

Tanks a lot bemorhona-qt....
It doesn't work at my end "not enough actual parameters..."
does it work at your end with the sample project posted on first post of this thread?

Yes it does work. Take a look at the attached file.

61

(6 replies, posted in General)

Solution for 1 section:
procedure frmCustomer_Button1_OnAfterClick (Sender: string);
begin
      Form1.tgSearch_Customers.dbItemID:= Last_Insert_id;
      Form1_tgSearch_Customers_OnCellClick('',0,0);
end;

Solution for 2 section:
procedure Form1_Button8_OnAfterClick (Sender: string);
var
i: integer;
begin
      i:= Form1.tgSearch_Customers.RowCount;
      Form1.tgSearch_Customers.SelectedRow:= i-1;
      Form1_tgSearch_Customers_OnCellClick('',0,0);
end;

Solution for 3 section is same as 1.

62

(5 replies, posted in General)

ehwagner wrote:

Not sure if this answers your question. But there isn't anything that MVD does automatically to upgrade database tables for users. What I do is create a separate MVD program. The only thing this MVD program does is run a script similar to the following:

SqlExecute('ALTER TABLE MyTable RENAME TO TempTable');
    SqlExecute('CREATE TABLE MyTable ('
      + 'id               INTEGER PRIMARY KEY ASC,'
      + 'Field1    TEXT,'
      + 'Field2    TEXT,'
      + 'Field3    TEXT,'
      + 'NewField  TEXT)');

    SqlExecute('INSERT INTO MyTable ('
                            + 'id,'
                            + 'Field1,'
                            + 'Field2,'
                            + 'Field3) '
                        + 'SELECT id,'
                            + 'Field1,'
                            + 'Field2,'
                            + 'Field3 '
                    + 'FROM TempTable');
    SqlExecute('DROP TABLE TempTable');

I use a third party install software to install the upgraded MVD application (without the database). The same install process then installs and runs the MVD database table upgrade program (script above). After the installation the database table upgrade MVD program is deleted because it's not needed any longer. One thing you have to pay attention to is making sure that the "server" setting in the settings.ini file in the database upgrade folder is pointing to the installed application database. My install process does this automatically so the user does not need to do anything. The whole thing is pretty seamless from my standpoint. Hope this helps.

Can you attach your project where you said that ou use third party install software?

63

(4 replies, posted in Russian)

увы ничего не получается, в программе моего шрифта не видно, что делать?

64

(4 replies, posted in Russian)

да я их просто копирую, сейчас попробую установить их и отпишусь.

65

(7 replies, posted in Script)

teco049 wrote:

REPAIRD.

After fixing some typing errors everything is working as planned.

Thank you.

Dear teco049!
Can you attach your project?

66

(4 replies, posted in Russian)

Уважаемый Дмитрий!
Программа MVD не видит шрифты, которые имеются в системе. Т.е. например в MS Woerd показываются все шрифты которые имеются в папке Windows\Fonts\ но в MVD не все шрифты показываются. Как быть?

67

(11 replies, posted in Russian)

Нашел решение, выражение выглядит так: \d,\d+
Мне надо было найти все числа которые имеют дробную часть, например 0,0350
Поясню для тех, кто не знает:
\d - любое число
, - понятно что запятая это дробная част
\d+ - опять любое число или больше

Вот вам все основные выражения которые используются:
[abc]    A single character of: a, b, or c
[^abc]    Any single character except: a, b, or c
[a-z]    Any single character in the range a-z
[a-zA-Z]    Any single character in the range a-z or A-Z
^    Start of line
$    End of line
\A    Start of string
\z    End of string
.    Any single character
\s    Any whitespace character
\S    Any non-whitespace character
\d    Any digit
\D    Any non-digit
\w    Any word character (letter, number, underscore)
\W    Any non-word character
\b    Any word boundary
(...)    Capture everything enclosed
(a|b)    a or b
a?    Zero or one of a
a*    Zero or more of a
a+    One or more of a
a{3}    Exactly 3 of a
a{3,}    3 or more of a
a{3,6}    Between 3 and 6 of a

Также прикрепил к примеру Дмитрия если он не против.

68

(11 replies, posted in Russian)

Уважаемый Дмитрий!
По поводу этого вопроса нашел вашу программу RegExp (http://myvisualdatabase.com/forum/misc. … download=1).
Теперь в поле Memo1 ставлю этот текст:
          1 2-71-23   2-22-42           ЋЃ‹.  ‡„ђЂ‚( ае)                        07.01/10:06     1    0,035
          2 2-71-23   2-22-42           ЋЃ‹.  ‡„ђЂ‚( ае)                        07.01/10:07     1    0,15
          3 2-71-23   2-33-71           ѓЋђЋ„‘ЉЂџ ЃЋ‹њЌ€–Ђ( ае)                 07.01/13:23     1    0,75
          4 2-71-23   2-33-71           ѓЋђЋ„‘ЉЂџ ЃЋ‹њЌ€–Ђ( ае)                 08.01/ 8:26     1    0,07
          5 2-71-23   2-33-71           ѓЋђЋ„‘ЉЂџ ЃЋ‹њЌ€–Ђ( ае)                 08.01/ 8:40     1    0,05
В поле Edit1 пишу 0(,*?) но результат у меня только 0. А надо чтобы в каждой строке искало 0, и выдавало все что находится после 0, и 0, включительно, пример:
0,035
0,15
0,75
0,07
0,05
Как быть?

69

(11 replies, posted in Russian)

Уважаемый alex842!
Спасибо за помощь, сделал как вы сказали, получилось но не так как надо. Надо это скриптом как это сделать.

70

(11 replies, posted in Russian)

Спасибо большое, есть очень срочная проблема:
Имеется txt файл в котором храниться детализация звонков. Примерная строка в файле выглядит так:

          1 2-71-23   2-22-42           ЋЃ‹.  ‡„ђЂ‚( ае)                        07.01/10:06     1    0,035
          2 2-71-23   2-22-42           ЋЃ‹.  ‡„ђЂ‚( ае)                        07.01/10:07     1    0,035
          3 2-71-23   2-33-71           ѓЋђЋ„‘ЉЂџ ЃЋ‹њЌ€–Ђ( ае)                 07.01/13:23     1    0,035
          4 2-71-23   2-33-71           ѓЋђЋ„‘ЉЂџ ЃЋ‹њЌ€–Ђ( ае)                 08.01/ 8:26     1    0,035
          5 2-71-23   2-33-71           ѓЋђЋ„‘ЉЂџ ЃЋ‹њЌ€–Ђ( ае)                 08.01/ 8:40     1    0,035

Этих строк очень много. Надо удалить все другие символы и оставить только сумму, в данном примере 0,035. Итого конечный результат будет:
0,035
0,035
0,035
0,035
Помогите с реализацией. Если можно с выгрузкой в Excel.

71

(11 replies, posted in Russian)

а как использовать функцию Random на примере букв, т.е. в реале она берет цифры от 0 до 10, а  надо чтобы брал буквы от А до Я.

72

(11 replies, posted in Russian)

Уважаемы Дмитрий!
1. Что такое функция Random? От англ - насколько я помню это случайно, поправьте если я не прав. Дайте пример использования этой функции
2. Чем отличается MessageDlg от MessageBox и дайте пожалуйста пример использования MessageBox

Спасибо заранее!

73

(5 replies, posted in Russian)

сам файл скрипта не исчезает, а исчезает содержимое этого файла

74

(5 replies, posted in Russian)

Напишу подробнее. У меня готовый проект работает на WindowsXP. Перешел на Windows 7. Установил MVD 3.1. Решил изменить проект, но увы в разделе Скрипты все пусто. В чем может быть проблема.

75

(1 replies, posted in Russian)

procedure AlternateRowColours;
var
   i,k,r,c: integer;
begin
     r := frmExpenseDS.TableGrid1.RowCount - 1;
     c := frmExpenseDS.TableGrid1.Columns.Count - 1;
     for i := 0 to r do
          begin
           if i mod 2 = 0 then
              begin
                for k := 0 to c do
                  begin
                    frmExpenseDS.TableGrid1.Cell[k,i].Color := $00F0F0F0;
                  end;
              end;
          end;
end;


Уважаемы Дмитрий!
Что означает for i mod 2=0 в данном скрипте?