Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunta la funzione di cancellazione dei giri git-svn-id: svn://10.65.10.50/trunk@17516 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									8f9f2eafa4
								
							
						
					
					
						commit
						be2238a4ef
					
				@ -1,5 +1,6 @@
 | 
			
		||||
#include <applicat.h>
 | 
			
		||||
#include <automask.h>
 | 
			
		||||
#include <defmask.h>
 | 
			
		||||
#include <progind.h>
 | 
			
		||||
#include <recarray.h>
 | 
			
		||||
#include <recset.h>
 | 
			
		||||
@ -23,6 +24,7 @@ class TGestione_planning_mask : public TAutomask
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  void fill_sheet();
 | 
			
		||||
  void erase_sheet();
 | 
			
		||||
  bool changed(TToken_string& oldrow, TToken_string& newrow, short id); 
 | 
			
		||||
  int codice_riga(const TDate& data);  
 | 
			
		||||
  void aggiorna_plan();
 | 
			
		||||
@ -93,6 +95,51 @@ void TGestione_planning_mask::fill_sheet()
 | 
			
		||||
  sheet.force_update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//questa funzione si occupa di cancellare tutti i dati visuliazzati nello sheet
 | 
			
		||||
void TGestione_planning_mask::erase_sheet()
 | 
			
		||||
{
 | 
			
		||||
  if (field(F_DADATA).empty() || field(F_ADATA).empty())
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  TString query = "USE LVRCONSPLAN KEY 2";
 | 
			
		||||
  const long coditi = get_long(F_CODITI);
 | 
			
		||||
  const long codcli = get_long(F_CODCF);
 | 
			
		||||
  if (coditi || codcli)
 | 
			
		||||
  {
 | 
			
		||||
    query << " SELECT ";
 | 
			
		||||
    if (codcli > 0)
 | 
			
		||||
      query << "(CODCF=" << codcli << ')';
 | 
			
		||||
    if (coditi > 0)    
 | 
			
		||||
    {
 | 
			
		||||
      if (codcli > 0)
 | 
			
		||||
        query << "&&";
 | 
			
		||||
      query << "(CODITI=" << coditi << ')';
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  query << "\n";
 | 
			
		||||
  query << "FROM DTCONS=" << get(F_DADATA) << "\n";
 | 
			
		||||
  query << "TO DTCONS=" << get(F_ADATA) << "\n";
 | 
			
		||||
 | 
			
		||||
  TISAM_recordset plan(query);
 | 
			
		||||
 | 
			
		||||
  if (yesno_box(FR("Si desidera eliminare %ld righe?"),plan.items()))
 | 
			
		||||
  {
 | 
			
		||||
    TProgind pi(plan.items(), TR("Cancellazione giri in corso..."), false, true);
 | 
			
		||||
 | 
			
		||||
    TLocalisamfile& rplan = plan.cursor()->file();  
 | 
			
		||||
 | 
			
		||||
    for (bool ok = plan.move_first(); ok; ok = plan.move_next())
 | 
			
		||||
	  {
 | 
			
		||||
	    if (!pi.addstatus(1))
 | 
			
		||||
		    break;
 | 
			
		||||
      rplan.remove();
 | 
			
		||||
    }
 | 
			
		||||
    TSheet_field& sheet = sfield(F_PLAN);
 | 
			
		||||
    sheet.destroy();
 | 
			
		||||
    sheet.force_update();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//funzione che confronta due due campi di una TToken_string e restitusce true se sono diversi
 | 
			
		||||
bool TGestione_planning_mask::changed(TToken_string& oldrow, TToken_string& newrow, short id)
 | 
			
		||||
{
 | 
			
		||||
@ -322,6 +369,13 @@ bool TGestione_planning_mask::on_field_event(TOperable_field& o, TField_event e,
 | 
			
		||||
{
 | 
			
		||||
  switch (o.dlg())
 | 
			
		||||
  {
 | 
			
		||||
  case DLG_DELREC:
 | 
			
		||||
    if (e == fe_button)
 | 
			
		||||
    {
 | 
			
		||||
      erase_sheet();
 | 
			
		||||
      return false;
 | 
			
		||||
    }
 | 
			
		||||
    break;
 | 
			
		||||
  //se questi campi vengono riempiti, allora riempi lo sheet opportunamante
 | 
			
		||||
  case F_DADATA:
 | 
			
		||||
  case F_ADATA:
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,47 @@
 | 
			
		||||
#include "lv2200a.h"
 | 
			
		||||
 | 
			
		||||
TOOLBAR "" 0 0 0 2
 | 
			
		||||
#include <printbar.h>
 | 
			
		||||
BUTTON DLG_PRINT 2 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 1 1 "Stampa"
 | 
			
		||||
  PICTURE BMP_PRINT
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BUTTON DLG_SETPRINT 2 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 2 1 "Imposta"
 | 
			
		||||
  PICTURE BMP_SETPRINT
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BUTTON DLG_DELREC 2 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 3 1 "Elimina"
 | 
			
		||||
  PICTURE BMP_DELREC
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BUTTON DLG_INFO 2 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 4 1 "Info"
 | 
			
		||||
  MESSAGE EXIT,K_F2
 | 
			
		||||
  PICTURE BMP_INFO
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BUTTON DLG_HELP 2 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 5 1 "Help"
 | 
			
		||||
  MESSAGE EXIT,K_F1
 | 
			
		||||
  PICTURE BMP_HELP
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
BUTTON DLG_QUIT 2 2
 | 
			
		||||
BEGIN
 | 
			
		||||
  PROMPT 6 1 "Fine"
 | 
			
		||||
  MESSAGE EXIT,K_QUIT
 | 
			
		||||
  PICTURE BMP_QUIT
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
PAGE "Visualizzazione e modifica giri" -1 -1 76 20
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user