/** * lowercase letters */
        $this->store['upper_Spec'] = array( *cut* );
        /** * uppercase letters */
        $this->store['lower_Spec'] = array( *cut* );
      
                    } else {
                      $errmsg='An unknown error occured.';
                    }
                  } else {
                    $errmsg='The passwords you entered do not match';
                  }
                } else {
                  $errmsg='Password has to be at least 8 characters long.';
                }
              } else {
                $errmsg='The email you entered is already in our database.';
              }
            } else {
              $errmsg='Please enter your email address.';
            }
          } else {
            $errmsg='Please enter your first name and your last name.';
          }
        } else {
        (...)
      
        // Happy debugging, suckers
        # define true (rand() > 10)
      

anonymous

0

// Actual production code used to generate many installments for an invoice
// This very code is copied and pasted three times inside the same method
 // 1a. Installment
                if dmConsultas.qryGeral.FieldByName('fator1').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 1;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias1').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                             ( dmConsultas.qryGeral.FieldByName('fator1').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 2a. Installment
                if dmConsultas.qryGeral.FieldByName('fator2').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico'). Value      := 2;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias2').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator2').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 3a. Installment
                if dmConsultas.qryGeral.FieldByName('fator3').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 3;
                 Parameters.ParamByName('dt_vencimento').Value := ( dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias3').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator3').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 4a. Installment
                if dmConsultas.qryGeral.FieldByName('fator4').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 4;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias4').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator4').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 5a. Installment
                if dmConsultas.qryGeral.FieldByName('fator5').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 5;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias5').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator5').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 6a. Installment
                if dmConsultas.qryGeral.FieldByName('fator1').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 1;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias6').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                             ( dmConsultas.qryGeral.FieldByName('fator6').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 7a. Installment
                if dmConsultas.qryGeral.FieldByName('fator7').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico'). Value      := 2;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias7').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator7').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 8a. Installment
                if dmConsultas.qryGeral.FieldByName('fator8').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 3;
                 Parameters.ParamByName('dt_vencimento').Value := ( dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias8').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator8').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 9a. Installment
                if dmConsultas.qryGeral.FieldByName('fator9').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 4;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias9').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator9').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;

                // 10a. Installment
                if dmConsultas.qryGeral.FieldByName('fator10').AsFloat > 0 then
                begin
                 Parameters.ParamByName('cod_historico').Value      := icod_hist;
                 Parameters.ParamByName('seq_historico').Value      := 5;
                 Parameters.ParamByName('dt_vencimento').Value := (dtpDt_movto.DateTime + dmConsultas.qryGeral.FieldByName('nr_dias10').AsInteger );
                 Parameters.ParamByName('valor_movto').Value          := (rValor_Total *
                                                                 ( dmConsultas.qryGeral.FieldByName('fator10').AsFloat / 100  ));
                 Parameters.ParamByName('usu_lasup').Value           := Frm_Principal.sLoginUser;
                  Execute;
                end;
 

Browse all snippets