How to use snapman to develop a complex software development project management system in three days

Keywords: C supervisor less REST

snapman is a simple and powerful team collaboration software, in which information can be data, rules, or automated code; most importantly, it is a collaboration platform that can be developed, all information can be applied to all people or machines, greatly reducing the complexity of work. Software development project is the most demanding project for human and mental cooperation in human engineering. Therefore, high IQ talents have developed various project definition implementation processes: PMBOK, CMMI, IPD, SCRUM, XP and so on. The implementation of these processes can not be separated from a variety of powerful information systems. However, these systems are only suitable for large company processes, and it is difficult to adapt to the specific characteristics of the project at the level of a single project group and change it as you like. For example, it is almost impossible to develop 10 software versions for 10 projects. Now let's look at how a person can develop a software project management system in just three days, and develop an adaptive system for each project in a short time, which will not be possible.

A software project includes: market, customer needs, design, development, testing, version release, financial repayment, software maintenance and other processes. The flower season project management system we designed today only includes the core parts of design, development, testing and release. The florescence project management system consists of:

Project information and team information

2. Design and Planning Information

3. Daily Work Daily for Employees

4. Bill of Lading and Tracking of Questions

5. Employee Performance Evaluation

Each link in the project is interrelated and closely dependent: build a project and team, design the system according to the requirements and work arrangement of each employee every day, employee work according to the plan and report daily, MDE accepts and evaluates the Story function, tester's bill of lading, developer fixes the problem until version. Successful release, after the final project is completed, the system and project manager evaluate the employees. The system spends most of the three days on business design, and the code implementation only takes a little more than a day:

First, the preferred part is data storage. Five tables are created as follows: Flower Season Project Information, Flower Season Planning Information, Flower Season Work Daily, Flower Season Question Tracking, Flower Season Employee Evaluation. These five tables are only used to store data and do not involve any code, so it takes 5-8 minutes to implement each table after the business is designed.

       

 

01. Flower Season Project Information. This table includes project related information, requirement task sheet, project attachments, necessary team members, roles and their supervisors. This table is maintained by PM directly, and the information in this table is used by the following work table.

        

 

02. Flower Season Plan Information. This table includes: key milestone time points of the project, work points of the project and the average number of points per person per day (using points to measure the complexity of a module to arrange the work of employees at different levels), work content and completion status of each employee per day; this table is maintained directly by PM, SE, MDE and TC. The information inside is used by the working table at the back.

        

 

03. Flower Season Work Daily, this table includes: every employee's work completion status, today's summary and tomorrow's plan, employee supervisor's acceptance and quality assessment of today's work completion; this table is checked by: 01. Flower Season My Daily, 01. Flower Season Daily, and two tables are automatically maintained.

        

 

04. Flower Season Problem Tracking. This table includes the problem elements of tester's bill of lading, tracking status and developer's analysis and repair status. This table is composed of: 03. Flower Season My Problem, 04. Flower Season My Test, and two tables are automatically maintained.

        

 

05. Flower Season Employee Assessment, this table includes: each employee's working status, work quality, work attitude, supervisor's assessment, etc. This table is from: 02. Flower Season Team Assessment, 01. Flower Season Daily Audit, two tables are automatically maintained.

        

 

Secondly, the staff work section is followed by the following four tables: Flower Season My Daily, Flower Season My Tasks, Flower Season My Questions, Flower Season My Tests; these four tables are the work that employees need to complete every day. These tables involve interface design and code control, which takes a total of half an hour, and code control takes less than an hour for each table.

Flower Season My Daily, this table includes: project information, staff's work points today, completion progress, today's summary, tomorrow's plan, work-related pictures and attachments. Incidents include:

A. Initialization of events, automatic acquisition of project information, and event code if you have written a daily report today to retrieve it from today's daily report:

int GetDaily(void *g,wchar_t *date,wchar_t *name)
{
    int row = 4;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(!d||!n)break;
        if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row;
        row++;
    }
    return 0;
}
wchar_t * GetUserManager(void *g,wchar_t *name)
{
    int row = 18;
    int col = 2;
    wchar_t *manager = NULL, *strName = NULL;
    while(1)
    {
        strName = SnapmanCellGetText(g,row,2);
        if(!strName || wcslen(strName)==0)break;
        if(wcsicmp(name,strName)==0)
        {
            manager = SnapmanCellGetText(g,row,13);
            break;
        }
        row++;
    }
    return manager;
}

void OnInitialize(void *g)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gDaily   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    if(gProject&&gDaily)
    {
        int row = GetDaily(gDaily,Date(),SnapmanGetUserName());
        if(row > 0)
        {
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4));
            SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6));
            SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7));
            SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10));
            SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9));
        }
        SnapmanCellSetLock(g,4,3,0);
        SnapmanCellSetLock(g,4,10,0);
        SnapmanCellSetLock(g,5,3,0);
        SnapmanCellSetLock(g,5,10,0);            
        SnapmanCellSetText(g,4,3,Date());
        SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3));
        SnapmanCellSetText(g,5,3,SnapmanGetUserName());
        SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName()));
        SnapmanCellSetLock(g,4,3,1);
        SnapmanCellSetLock(g,4,10,1);
        SnapmanCellSetLock(g,5,3,1);
        SnapmanCellSetLock(g,5,10,1);
    }
    SnapmanCleanUp();
}

B. Take yesterday's Daily Button Event, Event Code:

#include "time.h"
int GetLastDaily(void *g,wchar_t *date,wchar_t *name)
{
    int row = SnapmanGridGetDataRowCount(g,2);
    wchar_t *d,*n;
    while(row >= 4)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(d&&n)
        {
            if(wcsicmp(d,date)!=0&&wcsicmp(n,name)==0)return row;
        }
        row--;
    }
    return 0;
}

void OnButtonClick(void *g, int row, int col)
{
    void *gDaily   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    if(gDaily)
    {
        int row = GetLastDaily(gDaily,Date(),SnapmanGetUserName());
        if(row > 0)
        {
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4));
            SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6));
            SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7));
            SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10));
            SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9));
            MessageBox(SnapmanWnd,"Daily success!","Daily access",MB_OK);
        }else
        {
            MessageBox(SnapmanWnd,"I can't find yesterday's daily!","Daily access",MB_OK);
        }
    }
}

C. Submit Daily Button Event, Event Code:

int GetDaily(void *g,wchar_t *date,wchar_t *name)
{
    int row = 4;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(!d||!n)break;
        if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row;
        row++;
    }
    return 0;
}
void OnButtonClick(void *g, int row, int col)
{
    void *gDaily   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    if(gDaily)
    {
        wchar_t *strWorkPoint = SnapmanCellGetText(g,6,3);
        wchar_t *strWorkload  = SnapmanCellGetText(g,7,3);
        wchar_t *strPlanTomorrow = SnapmanCellGetText(g,14,3);
        if(!strWorkPoint || *strWorkPoint==0)
        {
            MessageBox(SnapmanWnd,"Please fill in the number of work points!","Submission daily",MB_OK);
            return;
        }
        if(!strWorkload || *strWorkload==0)
        {
            MessageBox(SnapmanWnd,"Please fill in today's work summary!","Submission daily",MB_OK);
            return;
        }
        if(!strPlanTomorrow || *strPlanTomorrow==0)
        {
            MessageBox(SnapmanWnd,"Please fill in the work plan for tomorrow!","Submission daily",MB_OK);
            return;
        }
        int row = GetDaily(gDaily,Date(),SnapmanGetUserName());
        if(row > 0)
        {
            SnapmanCellSetText(gDaily,row,4,SnapmanCellGetText(g,6,3));
            SnapmanCellSetInt(gDaily,row,5,SnapmanCellGetInt(g,6,10));
            SnapmanCellSetText(gDaily,row,6,SnapmanCellGetText(g,7,3));
            SnapmanCellSetText(gDaily,row,7,SnapmanCellGetText(g,14,3));
            SnapmanCellSetText(gDaily,row,8,DateTime());
            SnapmanCellSetFile(gDaily,row,10,SnapmanCellGetFile(g,21,10));
            SnapmanCellSetPicture(gDaily,row,9,SnapmanCellGetPicture(g,21,3));
        }else
        {
            int maxRow = SnapmanGridGetDataRowCount(gDaily,2) + 1;
            
            SnapmanCellSetText(gDaily,maxRow,1,itostr(maxRow-3));
            SnapmanCellSetText(gDaily,maxRow,2,Date());
            SnapmanCellSetText(gDaily,maxRow,3,SnapmanGetUserName());
            SnapmanCellSetText(gDaily,maxRow,4,SnapmanCellGetText(g,6,3));
            SnapmanCellSetInt(gDaily,maxRow,5,SnapmanCellGetInt(g,6,10));
            SnapmanCellSetText(gDaily,maxRow,6,SnapmanCellGetText(g,7,3));
            SnapmanCellSetText(gDaily,maxRow,7,SnapmanCellGetText(g,14,3));
            SnapmanCellSetText(gDaily,maxRow,8,DateTime());
            SnapmanCellSetFile(gDaily,maxRow,10,SnapmanCellGetFile(g,21,10));
            SnapmanCellSetPicture(gDaily,maxRow,9,SnapmanCellGetPicture(g,21,3));
        }
        if(SnapmanGridSave(gDaily))
        {
            MessageBox(SnapmanWnd,"Daily submission is successful!","Submission daily",MB_OK);
        }
    }
    SnapmanCleanUp();
}

D. After the final code is written, set the form to a non-saveable state, so that the form can only be used for work and not for data storage, so that everybody writes a daily newspaper without interacting with each other.

         

 

02. My tasks in the flowering season. This table includes project information, statistics of unfinished work before employees, task information for today and task completion status for today. Incidents include:

A. Initialization events, automatic acquisition of project information, automatic calculation of unfinished work before employees, automatic acquisition of tasks assigned today, acquisition of tasks submitted by employees, event code:

//I. Line Number of Task for Getting Date and Name
int GetPlanning(void *g,wchar_t *date,wchar_t *name)
{
    int row = 17;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,6);
        n = SnapmanCellGetText(g,row,12);
        if(!d||!n)break;
        if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row;
        row++;
    }
    return 0;
}
//2. Obtaining the name of its supervisor by name
wchar_t * GetUserManager(void *g,wchar_t *name)
{
    int row = 18;
    int col = 2;
    wchar_t *manager = NULL, *strName = NULL;
    while(1)
    {
        strName = SnapmanCellGetText(g,row,2);
        if(!strName || wcslen(strName)==0)break;
        if(wcsicmp(name,strName)==0)
        {
            manager = SnapmanCellGetText(g,row,13);
            break;
        }
        row++;
    }
    return manager;
}
//Setting up User Information
void SetUserInfo(void *g,void *gProject)
{
    SnapmanCellSetLock(g,4,3,0);
    SnapmanCellSetLock(g,4,10,0);
    SnapmanCellSetLock(g,5,3,0);
    SnapmanCellSetLock(g,5,10,0);            
    SnapmanCellSetText(g,4,3,Date());
    SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3));
    SnapmanCellSetText(g,5,3,SnapmanGetUserName());
    SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName()));
    SnapmanCellSetLock(g,4,3,1);
    SnapmanCellSetLock(g,4,10,1);
    SnapmanCellSetLock(g,5,3,1);
    SnapmanCellSetLock(g,5,10,1);
}
//IV. Setting up Planning Information
void SetPlanningInfo(void *g,void *gPlanning,int row)
{
    //1,Set up the planned tasks to be completed today
    SnapmanCellSetLock(g,7,5,0);
    SnapmanCellSetLock(g,9,5,0);
    SnapmanCellSetLock(g,11,5,0);
    SnapmanCellSetLock(g,13,5,0);
    SnapmanCellSetLock(g,14,5,0);
    SnapmanCellSetText(g,7,5,SnapmanCellGetText(gPlanning,row,2));
    SnapmanCellSetText(g,9,5,SnapmanCellGetText(gPlanning,row,3));
    SnapmanCellSetText(g,11,5,SnapmanCellGetText(gPlanning,row,4));
    SnapmanCellSetText(g,13,5,SnapmanCellGetText(gPlanning,row,5));
    SnapmanCellSetText(g,14,5,SnapmanCellGetText(gPlanning,row,6));
    SnapmanCellSetLock(g,7,5,1);
    SnapmanCellSetLock(g,9,5,1);
    SnapmanCellSetLock(g,11,5,1);
    SnapmanCellSetLock(g,13,5,1);
    SnapmanCellSetLock(g,14,5,1);
    //2,Set today's task completion status
    SnapmanCellSetText(g,18,3,SnapmanCellGetText(gPlanning,row,8));
    SnapmanCellSetText(g,20,3,SnapmanCellGetText(gPlanning,row,9));
    SnapmanCellSetText(g,22,3,SnapmanCellGetText(gPlanning,row,10));
    SnapmanCellSetText(g,24,3,SnapmanCellGetText(gPlanning,row,11));
    SnapmanCellSetProgress(g,26,3,SnapmanCellGetInt(gPlanning,row,7));
    SnapmanCellSetText(g,29,3,SnapmanCellGetText(gPlanning,row,14));
}
//5. Calculate and set up unfinished work
void SetUnfinishedInfo(void *g,void *gPlanning)
{
    int nUnfinished = 0,nProgress = 0;
    wchar_t *d,*n;
    wchar_t *today  =  SnapmanCellGetText(g,4,3);
    wchar_t *name  =  SnapmanCellGetText(g,5,3);
    if(!today||!name)return;
    int nTotalPlanning = SnapmanGridGetDataRowCount(gPlanning,1);
    for(int row = 17; row <= nTotalPlanning; row++)
    {
        d = SnapmanCellGetText(gPlanning,row,6);
        n = SnapmanCellGetText(gPlanning,row,12);
        nProgress = SnapmanCellGetInt(gPlanning,row,7);
        if(d&&n&&nProgress!=100&&wcsicmp(d,today)<0&&wcsicmp(n,name)==0)nUnfinished++;
    }
    if(nUnfinished > 0)
    {
        SnapmanCellSetText(g,6,3,concat3(L("You have one ahead of you."),itostr(nUnfinished),L("Days of work are not normally completed, please take the task of the previous day to complete it.")));
    }else
    {
        SnapmanCellSetText(g,6,3,L("The work ahead of you has been completed normally. That's great!"));
    }
    
}
//Table Initialization Event Function
void OnInitialize(void *g)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gPlanning   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    if(gProject&&gPlanning)
    {
        int row = GetPlanning(gPlanning,Date(),SnapmanGetUserName());
        if(row > 0)
        {
            SetPlanningInfo(g,gPlanning,row);
        }else
        {
            Print("There is no task for you today. Please have a good rest.");
        }
        SetUserInfo(g,gProject);
        SetUnfinishedInfo(g,gPlanning);
    }
    SnapmanCleanUp();
}

B. Task Button Event of the Last Day, Event Code:

//I. Line Number of Task for Getting Date and Name
int GetLastDayPlanning(void *g,wchar_t *date,wchar_t *name)
{
    int row = 17,result = 0;
    wchar_t *d,*n,*l = NULL;
    while(1)
    {
        d = SnapmanCellGetText(g,row,6);
        n = SnapmanCellGetText(g,row,12);
        if(!d||!n)break;
        if(wcsicmp(d,date)<0&&wcsicmp(n,name)==0)
        {
            if(!l||wcsicmp(d,l)>0)
            {
                result = row;
                l = d;
            }
        }
        row++;
    }
    return result;
}
//2. Obtaining the name of its supervisor by name
wchar_t * GetUserManager(void *g,wchar_t *name)
{
    int row = 18;
    int col = 2;
    wchar_t *manager = NULL, *strName = NULL;
    while(1)
    {
        strName = SnapmanCellGetText(g,row,2);
        if(!strName || wcslen(strName)==0)break;
        if(wcsicmp(name,strName)==0)
        {
            manager = SnapmanCellGetText(g,row,13);
            break;
        }
        row++;
    }
    return manager;
}
//IV. Setting up Planning Information
void SetPlanningInfo(void *g,void *gPlanning,int row)
{
    //1,Set up the planned tasks to be completed today
    SnapmanCellSetLock(g,4,3,0);
    SnapmanCellSetLock(g,7,5,0);
    SnapmanCellSetLock(g,9,5,0);
    SnapmanCellSetLock(g,11,5,0);
    SnapmanCellSetLock(g,13,5,0);
    SnapmanCellSetLock(g,14,5,0);
    SnapmanCellSetText(g,4,3,SnapmanCellGetText(gPlanning,row,6));
    SnapmanCellSetText(g,7,5,SnapmanCellGetText(gPlanning,row,2));
    SnapmanCellSetText(g,9,5,SnapmanCellGetText(gPlanning,row,3));
    SnapmanCellSetText(g,11,5,SnapmanCellGetText(gPlanning,row,4));
    SnapmanCellSetText(g,13,5,SnapmanCellGetText(gPlanning,row,5));
    SnapmanCellSetText(g,14,5,SnapmanCellGetText(gPlanning,row,6));
    SnapmanCellSetLock(g,4,3,1);
    SnapmanCellSetLock(g,7,5,1);
    SnapmanCellSetLock(g,9,5,1);
    SnapmanCellSetLock(g,11,5,1);
    SnapmanCellSetLock(g,13,5,1);
    SnapmanCellSetLock(g,14,5,1);
    //2,Set today's task completion status
    SnapmanCellSetText(g,18,3,SnapmanCellGetText(gPlanning,row,8));
    SnapmanCellSetText(g,20,3,SnapmanCellGetText(gPlanning,row,9));
    SnapmanCellSetText(g,22,3,SnapmanCellGetText(gPlanning,row,10));
    SnapmanCellSetText(g,24,3,SnapmanCellGetText(gPlanning,row,11));
    SnapmanCellSetProgress(g,26,3,SnapmanCellGetInt(gPlanning,row,7));
    SnapmanCellSetText(g,29,3,SnapmanCellGetText(gPlanning,row,14));
}
//5. Calculate and set up unfinished work
void SetUnfinishedInfo(void *g,void *gPlanning)
{
    int nUnfinished = 0,nProgress = 0;
    wchar_t *d,*n;
    wchar_t *today  =  SnapmanCellGetText(g,4,3);
    wchar_t *name  =  SnapmanCellGetText(g,5,3);
    if(!today||!name)return;
    int nTotalPlanning = SnapmanGridGetDataRowCount(gPlanning,1);
    for(int row = 17; row <= nTotalPlanning; row++)
    {
        d = SnapmanCellGetText(gPlanning,row,6);
        n = SnapmanCellGetText(gPlanning,row,12);
        nProgress = SnapmanCellGetInt(gPlanning,row,7);
        if(d&&n&&nProgress!=100&&wcsicmp(d,today)<0&&wcsicmp(n,name)==0)nUnfinished++;
    }
    if(nUnfinished > 0)
    {
        SnapmanCellSetText(g,6,3,concat3(L("You have one ahead of you."),itostr(nUnfinished),L("Days of work are not normally completed, please take the task of the previous day to complete it.")));
    }else
    {
        SnapmanCellSetText(g,6,3,L("The work ahead of you has been completed normally. That's great!"));
    }
    
}
//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gPlanning   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    if(gProject&&gPlanning)
    {
        int row = GetLastDayPlanning(gPlanning,SnapmanCellGetText(g,4,3),SnapmanCellGetText(g,5,3));
        if(row > 0)
        {
            SetPlanningInfo(g,gPlanning,row);
            SetUnfinishedInfo(g,gPlanning);
        }else
        {
            Print("Didn't find the last day's task!");
        }
    }
    SnapmanCleanUp();
}

C. Next day Task button event, event code:

//I. Line Number of Task for Getting Date and Name
int GetNextDayPlanning(void *g,wchar_t *date,wchar_t *name)
{
    int row = 17,result = 0;
    wchar_t *d,*n,*l = NULL;
    while(1)
    {
        d = SnapmanCellGetText(g,row,6);
        n = SnapmanCellGetText(g,row,12);
        if(!d||!n)break;
        if(wcsicmp(d,date)>0&&wcsicmp(n,name)==0)
        {
            if(!l||wcsicmp(d,l)<0)
            {
                result = row;
                l = d;
            }
        }
        row++;
    }
    return result;
}
//2. Obtaining the name of its supervisor by name
wchar_t * GetUserManager(void *g,wchar_t *name)
{
    int row = 18;
    int col = 2;
    wchar_t *manager = NULL, *strName = NULL;
    while(1)
    {
        strName = SnapmanCellGetText(g,row,2);
        if(!strName || wcslen(strName)==0)break;
        if(wcsicmp(name,strName)==0)
        {
            manager = SnapmanCellGetText(g,row,13);
            break;
        }
        row++;
    }
    return manager;
}
//IV. Setting up Planning Information
void SetPlanningInfo(void *g,void *gPlanning,int row)
{
    //1,Set up the planned tasks to be completed today
    SnapmanCellSetLock(g,4,3,0);
    SnapmanCellSetLock(g,7,5,0);
    SnapmanCellSetLock(g,9,5,0);
    SnapmanCellSetLock(g,11,5,0);
    SnapmanCellSetLock(g,13,5,0);
    SnapmanCellSetLock(g,14,5,0);
    SnapmanCellSetText(g,4,3,SnapmanCellGetText(gPlanning,row,6));
    SnapmanCellSetText(g,7,5,SnapmanCellGetText(gPlanning,row,2));
    SnapmanCellSetText(g,9,5,SnapmanCellGetText(gPlanning,row,3));
    SnapmanCellSetText(g,11,5,SnapmanCellGetText(gPlanning,row,4));
    SnapmanCellSetText(g,13,5,SnapmanCellGetText(gPlanning,row,5));
    SnapmanCellSetText(g,14,5,SnapmanCellGetText(gPlanning,row,6));
    SnapmanCellSetLock(g,4,3,1);
    SnapmanCellSetLock(g,7,5,1);
    SnapmanCellSetLock(g,9,5,1);
    SnapmanCellSetLock(g,11,5,1);
    SnapmanCellSetLock(g,13,5,1);
    SnapmanCellSetLock(g,14,5,1);
    //2,Set today's task completion status
    SnapmanCellSetText(g,18,3,SnapmanCellGetText(gPlanning,row,8));
    SnapmanCellSetText(g,20,3,SnapmanCellGetText(gPlanning,row,9));
    SnapmanCellSetText(g,22,3,SnapmanCellGetText(gPlanning,row,10));
    SnapmanCellSetText(g,24,3,SnapmanCellGetText(gPlanning,row,11));
    SnapmanCellSetProgress(g,26,3,SnapmanCellGetInt(gPlanning,row,7));
    SnapmanCellSetText(g,29,3,SnapmanCellGetText(gPlanning,row,14));
}
//5. Calculate and set up unfinished work
void SetUnfinishedInfo(void *g,void *gPlanning)
{
    int nUnfinished = 0,nProgress = 0;
    wchar_t *d,*n;
    wchar_t *today  =  SnapmanCellGetText(g,4,3);
    wchar_t *name  =  SnapmanCellGetText(g,5,3);
    if(!today||!name)return;
    int nTotalPlanning = SnapmanGridGetDataRowCount(gPlanning,1);
    for(int row = 17; row <= nTotalPlanning; row++)
    {
        d = SnapmanCellGetText(gPlanning,row,6);
        n = SnapmanCellGetText(gPlanning,row,12);
        nProgress = SnapmanCellGetInt(gPlanning,row,7);
        if(d&&n&&nProgress!=100&&wcsicmp(d,today)<0&&wcsicmp(n,name)==0)nUnfinished++;
    }
    if(nUnfinished > 0)
    {
        SnapmanCellSetText(g,6,3,concat3(L("You have one ahead of you."),itostr(nUnfinished),L("Days of work are not normally completed, please take the task of the previous day to complete it.")));
    }else
    {
        SnapmanCellSetText(g,6,3,L("The work ahead of you has been completed normally. That's great!"));
    }
    
}
//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gPlanning   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    if(gProject&&gPlanning)
    {
        int row = GetNextDayPlanning(gPlanning,SnapmanCellGetText(g,4,3),SnapmanCellGetText(g,5,3));
        if(row > 0)
        {
            SetPlanningInfo(g,gPlanning,row);
            SetUnfinishedInfo(g,gPlanning);
        }else
        {
            Print("There is no assignment for the next day. Finally, I can have a rest.");
        }
    }
    SnapmanCleanUp();
}

D. Submit Task Progress Button Event, Event Code:

//I. Line Number of Task for Getting Date and Name
int GetPlanning(void *g,wchar_t *date,wchar_t *name)
{
    int row = 17;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,6);
        n = SnapmanCellGetText(g,row,12);
        if(!d||!n)break;
        if(wcsicmp(d,date)==0&&wcsicmp(n,name)==0)return row;
        row++;
    }
    return 0;
}

//IV. Setting up Planning Information
void SavePlanningInfo(void *g,void *gPlanning,int row)
{
    //2,Set today's task completion status
    SnapmanCellSetText(gPlanning,row,8,SnapmanCellGetText(g,18,3));
    SnapmanCellSetText(gPlanning,row,9,SnapmanCellGetText(g,20,3));
    SnapmanCellSetText(gPlanning,row,10,SnapmanCellGetText(g,22,3));
    SnapmanCellSetText(gPlanning,row,11,SnapmanCellGetText(g,24,3));
    SnapmanCellSetProgress(gPlanning,row,7,SnapmanCellGetInt(g,26,3));
    SnapmanCellSetText(gPlanning,row,14,SnapmanCellGetText(g,29,3));
    SnapmanGridSave(gPlanning);
}

//Table Initialization Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gPlanning   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    if(gPlanning)
    {
        wchar_t *today  =  SnapmanCellGetText(g,4,3);
        wchar_t *name  =  SnapmanCellGetText(g,5,3);
        int row = GetPlanning(gPlanning,today,name);
        if(row > 0)
        {
            SavePlanningInfo(g,gPlanning,row);
        }else
        {
            Print("There is no task for you today. Please have a good rest.");
        }
    }
    SnapmanCleanUp();
}

E. After the final code is written, set the table to a non-saveable state, so that the table can only be used for work and not for data storage, so that the progress of tasks written by each person will not affect each other.

         

 

03. Flower Season My Questions. This table includes: Project Information, My Question List, Current Selection Question Information, and How to Deal with the Question. Incidents include:

A. Initialization of events, automatic acquisition of project information, my list of questions, presentation of current selected problem information, and handling of this problem. Problems are also divided into developer problems and tester problems with different emphasis, event code:

wchar_t *GetDevTestProblemList(void *g,wchar_t *name)
{
    wchar_t *result = NULL,*n,*t;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = 4;row <= maxrow; row++)
    {
        t = SnapmanCellGetText(g,row,7);
        n = SnapmanCellGetText(g,row,13);
        if(n&&(0==wcsicmp(name,n)||0==wcsicmp(t,name)))//Developers or testers are listed.
        {
            if(result==NULL)
            {
                result = SnapmanCellGetText(g,row,1);
            }else
            {
                result = concat3(result,L"\n",SnapmanCellGetText(g,row,1));
            }
        }
    }
    return result;
}
int GetLastDevRow(void *g,wchar_t *name)
{
    wchar_t *n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = maxrow;row >= 4; row--)
    {
        n = SnapmanCellGetText(g,row,13);
        if(n&&0==wcsicmp(name,n))
        {
            return row;
        }
    }
    return 0;
}

//2. Obtaining the name of its supervisor by name
wchar_t * GetUserManager(void *g,wchar_t *name)
{
    int row = 18;
    int col = 2;
    wchar_t *manager = NULL, *strName = NULL;
    while(1)
    {
        strName = SnapmanCellGetText(g,row,2);
        if(!strName || wcslen(strName)==0)break;
        if(wcsicmp(name,strName)==0)
        {
            manager = SnapmanCellGetText(g,row,13);
            break;
        }
        row++;
    }
    return manager;
}
//Setting up User Information
void SetUserInfo(void *g,void *gProject)
{
    SnapmanCellSetLock(g,4,3,0);
    SnapmanCellSetLock(g,4,10,0);
    SnapmanCellSetLock(g,5,3,0);
    SnapmanCellSetLock(g,5,10,0);            
    SnapmanCellSetText(g,4,3,Date());
    SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3));
    SnapmanCellSetText(g,5,3,SnapmanGetUserName());
    SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName()));
    SnapmanCellSetLock(g,4,3,1);
    SnapmanCellSetLock(g,4,10,1);
    SnapmanCellSetLock(g,5,3,1);
    SnapmanCellSetLock(g,5,10,1);
}

void SetProblemInfo(void *g,void *gProblem,int row)
{
    if(row > 0)
    {
        if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//It's a tester.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
            
            SnapmanCellSetBackgoundColor(g,34,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,10,14806254);
            SnapmanCellSetBackgoundColor(g,48,3,14806254);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
        }else//It's a developer.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
        }
    }
}
void OnInitialize(void *g)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SnapmanCellSetCombo(g,6,3,GetDevTestProblemList(gProblem,SnapmanGetUserName()));
        SetProblemInfo(g,gProblem,GetLastDevRow(gProblem,SnapmanGetUserName()));
        SetUserInfo(g,gProject);
    }
    SnapmanCleanUp();
}

B. Selection of events in the drop-down box of my questionnaires, access to current problem information display, handling of the problem, event code:

int GetProblemRow(void *g,wchar_t *Index)
{
    wchar_t *n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = 4;row <= maxrow; row++)
    {
        n = SnapmanCellGetText(g,row,1);
        if(n&&0==wcsicmp(Index,n))
        {
            return row;
        }
    }
    return 0;
}

void SetProblemInfo(void *g,void *gProblem,int row)
{
    if(row > 0)
    {
        if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//It's a tester.
        {
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
            
            SnapmanCellSetBackgoundColor(g,34,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,10,14806254);
            SnapmanCellSetBackgoundColor(g,48,3,14806254);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
        }else//It's a developer.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
        }
    }
}

void OnComboChanged(void *g, int row, int col,wchar_t *text)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SetProblemInfo(g,gProblem,GetProblemRow(gProblem,text));
    }
}

C. Take up a question button event, get the last question information display, the problem handling status, event code:

int GetLastDevRow(void *g,wchar_t *name)
{
    wchar_t *n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = maxrow;row >= 4; row--)
    {
        n = SnapmanCellGetText(g,row,13);
        if(n&&0==wcsicmp(name,n))
        {
            return row;
        }
    }
    return 0;
}

int GetPrevDevRow(void *g,wchar_t *name,wchar_t *curIndex)
{
    if(curIndex==NULL||curIndex[0]==0)
    {
        return GetLastDevRow(g,name);
    }else
    {
        int result = 0;
        wchar_t *n,*d,*l = NULL;
        int maxrow = SnapmanGridGetTotalDataRow(g);
        for(int row = maxrow;row >= 4; row--)
        {
            n = SnapmanCellGetText(g,row,13);
            d = SnapmanCellGetText(g,row,1);
            if(n&&0==wcsicmp(name,n)&& d && wcsicmp(d,curIndex) < 0)
            {
                if(!l||wcsicmp(d,l)>0)
                {
                    result = row;
                    l = d;
                }
            }
        }
        return result;
    }
}

void SetProblemInfo(void *g,void *gProblem,int row)
{
    if(row > 0)
    {
        if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//It's a tester.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
            
            SnapmanCellSetBackgoundColor(g,34,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,10,14806254);
            SnapmanCellSetBackgoundColor(g,48,3,14806254);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
        }else//It's a developer.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
        }
    }else
    {
        Print("No last question!");
    }
}

//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SetProblemInfo(g,gProblem,GetPrevDevRow(gProblem,SnapmanGetUserName(),SnapmanCellGetText(g,6,3)));
    }
    SnapmanCleanUp();
}

D. Take the next question button event, get the next question information display, the problem handling status, event code:

int GetLastDevRow(void *g,wchar_t *name)
{
    wchar_t *n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = maxrow;row >= 4; row--)
    {
        n = SnapmanCellGetText(g,row,13);
        if(n&&0==wcsicmp(name,n))
        {
            return row;
        }
    }
    return 0;
}

int GetNextDevRow(void *g,wchar_t *name,wchar_t *curIndex)
{
    if(curIndex==NULL||curIndex[0]==0)
    {
        return GetLastDevRow(g,name);
    }else
    {
        int result = 0;
        wchar_t *n,*d,*l = NULL;
        int maxrow = SnapmanGridGetTotalDataRow(g);
        for(int row = maxrow;row >= 4; row--)
        {
            n = SnapmanCellGetText(g,row,13);
            d = SnapmanCellGetText(g,row,1);
            if(n&&0==wcsicmp(name,n)&& d && wcsicmp(d,curIndex) > 0)
            {
                if(!l||wcsicmp(d,l)<0)
                {
                    result = row;
                    l = d;
                }
            }
        }
        return result;
    }
}

void SetProblemInfo(void *g,void *gProblem,int row)
{
    if(row > 0)
    {
        if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//It's a tester.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
            
            SnapmanCellSetBackgoundColor(g,34,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,10,14806254);
            SnapmanCellSetBackgoundColor(g,48,3,14806254);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
        }else//It's a developer.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
        }
    }else
    {
        Print("There's no next question!");
    }
}

//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SetProblemInfo(g,gProblem,GetNextDevRow(gProblem,SnapmanGetUserName(),SnapmanCellGetText(g,6,3)));
    }
    SnapmanCleanUp();
}

E. Submit Question Progress Button Event, Event Code:

int GetProblemRow(void *g,wchar_t *Index)
{
    wchar_t *n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = 4;row <= maxrow; row++)
    {
        n = SnapmanCellGetText(g,row,1);
        if(n&&0==wcsicmp(Index,n))
        {
            return row;
        }
    }
    return 0;
}
void SaveProblemProgress(void *g,void *gProblem)
{
    wchar_t *d = SnapmanCellGetText(g,6,3);
    if(d&&d[0]!=0)
    {
        int row = GetProblemRow(gProblem,d);
        if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//It's a tester.
        {
            if(SnapmanCellIsEmpty(g,7,10))
            {
                Print("Please fill in the question status!");
            }else
            {
                SnapmanCellSetText(gProblem,row,9,SnapmanCellGetText(g,7,10));
                SnapmanGridSave(gProblem);
                Print("Successful submission of problem progress!");
            }
        }else if(row>0)//It's a developer.
        {
            if(SnapmanCellIsEmpty(g,7,10))
            {
                Print("Please fill in the question status!");
            }else if(SnapmanCellIsEmpty(g,34,3))
            {
                Print("Please fill in the question analysis!");
            }else if(SnapmanCellIsEmpty(g,47,3))
            {
                Print("Please fill in the repair time!");
            }else if(SnapmanCellIsEmpty(g,47,10))
            {
                Print("Please fill in the repair version!");
            }else
            {
                SnapmanCellSetText(gProblem,row,9,SnapmanCellGetText(g,7,10));
                SnapmanCellSetText(gProblem,row,10,SnapmanCellGetText(g,34,3));
                SnapmanCellSetText(gProblem,row,11,SnapmanCellGetText(g,47,3));
                SnapmanCellSetText(gProblem,row,12,SnapmanCellGetText(g,47,10));
                SnapmanCellSetText(gProblem,row,14,SnapmanCellGetText(g,48,3));
                SnapmanGridSave(gProblem);
                Print("Successful submission of problem progress!");
            }
        }else
        {
            wPrint(L("Question list could not be found as follows:%s"),d);
        }
    }else
    {
        Print("Please choose the question number!");
    }
}

//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SaveProblemProgress(g,gProblem);
    }
    SnapmanCleanUp();
}

F. After the final code is written, set the table to a non-saveable state, so that the table can only be used for work and not for data storage, so that the progress of problem handling written by each person will not affect each other.

         

 

04. Flower Season My Testing. This table includes the problem elements of tester's bill of lading, tracking status and developer's analysis and repair status. This table is composed of: 03. Flower Season My Problems, 04. Flower Season My Testing, and two tables are automatically maintained.

A. Initialization of events, automatic acquisition of project information, my list of questions, presentation of currently selected questions, event code:

wchar_t *GetUserProblemList(void *g,wchar_t *name)
{
    wchar_t *result = NULL,*n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = 4;row <= maxrow; row++)
    {
        n = SnapmanCellGetText(g,row,7);
        if(n&&0==wcsicmp(name,n))
        {
            if(result==NULL)
            {
                result = n;
            }else
            {
                result = concat3(result,L"\n",n);
            }
        }
    }
    return result;
}
wchar_t *GetDevList(void *g)
{
    wchar_t *result = NULL,*n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = 18;row <= maxrow; row++)
    {
        n = SnapmanCellGetText(g,row,2);
        if(n&&n[0]!=0)
        {
            if(result==NULL)
            {
                result = n;
            }else
            {
                result = concat3(result,L"\n",n);
            }
        }
    }
    return result;
}
//2. Obtaining the name of its supervisor by name
wchar_t * GetUserManager(void *g,wchar_t *name)
{
    int row = 18;
    int col = 2;
    wchar_t *manager = NULL, *strName = NULL;
    while(1)
    {
        strName = SnapmanCellGetText(g,row,2);
        if(!strName || wcslen(strName)==0)break;
        if(wcsicmp(name,strName)==0)
        {
            manager = SnapmanCellGetText(g,row,13);
            break;
        }
        row++;
    }
    return manager;
}
//Setting up User Information
void SetUserInfo(void *g,void *gProject)
{
    SnapmanCellSetLock(g,4,3,0);
    SnapmanCellSetLock(g,4,10,0);
    SnapmanCellSetLock(g,5,3,0);
    SnapmanCellSetLock(g,5,10,0);            
    SnapmanCellSetText(g,4,3,Date());
    SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3));
    SnapmanCellSetText(g,5,3,SnapmanGetUserName());
    SnapmanCellSetText(g,5,10,GetUserManager(gProject,SnapmanGetUserName()));
    SnapmanCellSetLock(g,4,3,1);
    SnapmanCellSetLock(g,4,10,1);
    SnapmanCellSetLock(g,5,3,1);
    SnapmanCellSetLock(g,5,10,1);
}
void OnInitialize(void *g)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SnapmanCellSetCombo(g,6,3,GetUserProblemList(g,SnapmanGetUserName()));
        SnapmanCellSetCombo(g,7,3,GetDevList(gProject));
        SetUserInfo(g,gProject);
        
    }
}

B. Selection of events in the drop-down box of my questionnaires, access to the current problem information display, event code:

int GetProblemRow(void *g,wchar_t *Index)
{
    wchar_t *n;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = 4;row <= maxrow; row++)
    {
        n = SnapmanCellGetText(g,row,1);
        if(n&&0==wcsicmp(Index,n))
        {
            return row;
        }
    }
    return 0;
}

void SetProblemInfo(void *g,void *gProblem,int row)
{
    if(row > 0)
    {
        if(0==wcsicmp(SnapmanGetUserName(),SnapmanCellGetText(gProblem,row,7)))//It's a tester.
        {
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
            
            SnapmanCellSetBackgoundColor(g,34,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,3,14806254);
            SnapmanCellSetBackgoundColor(g,47,10,14806254);
            SnapmanCellSetBackgoundColor(g,48,3,14806254);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
        }else//It's a developer.
        {
            SnapmanCellSetLock(g,6,3,0);
            SnapmanCellSetLock(g,6,10,0);
            SnapmanCellSetLock(g,7,3,0);
            SnapmanCellSetLock(g,8,3,0);
            SnapmanCellSetLock(g,10,3,0);
            SnapmanCellSetLock(g,23,3,0);
            SnapmanCellSetLock(g,23,10,0);
            
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
            SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,7));
            SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
            SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
            SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
            SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
            SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
            
            SnapmanCellSetLock(g,6,3,1);
            SnapmanCellSetLock(g,6,10,1);
            SnapmanCellSetLock(g,7,3,1);;
            SnapmanCellSetLock(g,8,3,1);
            SnapmanCellSetLock(g,10,3,1);
            SnapmanCellSetLock(g,23,3,1);
            SnapmanCellSetLock(g,23,10,1);
            
            SnapmanCellSetLock(g,34,3,1);
            SnapmanCellSetLock(g,47,3,1);
            SnapmanCellSetLock(g,47,10,1);
            SnapmanCellSetLock(g,48,3,1);
            
            SnapmanCellSetText(g,34,3,SnapmanCellGetText(gProblem,row,10));
            SnapmanCellSetText(g,47,3,SnapmanCellGetText(gProblem,row,11));
            SnapmanCellSetText(g,47,10,SnapmanCellGetText(gProblem,row,12));
            SnapmanCellSetText(g,48,3,SnapmanCellGetText(gProblem,row,14));
        }
    }
}

void OnComboChanged(void *g, int row, int col,wchar_t *text)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        SetProblemInfo(g,gProblem,GetProblemRow(gProblem,text));
    }
}

C. Take a question button event, get the last question information display, event code:

//I. Line Number of Task for Getting Date and Name
int GetPrevProblem(void *g,int index,wchar_t *name)
{
    wchar_t *n = NULL;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = maxrow;row >= 4; row--)
    {
        n = SnapmanCellGetText(g,row,7);
        if(n&&0==wcsicmp(name,n))
        {
            if(index==0)
            {
                return row;
            }else if(SnapmanCellGetInt(g,row,1)<index)
            {
                return row;    
            }
        }
    }
    return 0;
}
void SetProblemInfo(void *g,void *gProblem,int row)
{
    SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
    SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
    SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,13));
    SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
    SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
    SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
    SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
    SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
}
//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        int row = GetPrevProblem(gProblem,SnapmanCellGetInt(g,6,3),SnapmanCellGetText(g,5,3));
        if(row > 0)
        {
            SetProblemInfo(g,gProblem,row);
        }else
        {
            Print("I can't find the last question list.");
        }
    }
    SnapmanCleanUp();
}

D. Take the next question button event, get the next question information display, event code:

//I. Line Number of Task for Getting Date and Name
int GetNextProblem(void *g,int index,wchar_t *name)
{
    wchar_t *n = NULL;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    for(int row = maxrow;row >= 4; row--)
    {
        n = SnapmanCellGetText(g,row,7);
        if(n&&0==wcsicmp(name,n))
        {
            if(index==0)
            {
                return row;
            }else if(SnapmanCellGetInt(g,row,1)>index)
            {
                return row;    
            }
        }
    }
    return 0;
}
void SetProblemInfo(void *g,void *gProblem,int row)
{
    SnapmanCellSetText(g,6,3,SnapmanCellGetText(gProblem,row,1));
    SnapmanCellSetText(g,6,10,SnapmanCellGetText(gProblem,row,8));
    SnapmanCellSetText(g,7,3,SnapmanCellGetText(gProblem,row,13));
    SnapmanCellSetText(g,7,10,SnapmanCellGetText(gProblem,row,9));
    SnapmanCellSetText(g,8,3,SnapmanCellGetText(gProblem,row,2));
    SnapmanCellSetText(g,10,3,SnapmanCellGetText(gProblem,row,3));
    SnapmanCellSetPicture(g,23,3,SnapmanCellGetPicture(gProblem,row,4));
    SnapmanCellSetFile(g,23,10,SnapmanCellGetFile(gProblem,row,5));
}
//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    if(gProject&&gProblem)
    {
        int row = GetNextProblem(gProblem,SnapmanCellGetInt(g,6,3),SnapmanCellGetText(g,5,3));
        if(row > 0)
        {
            SetProblemInfo(g,gProblem,row);
        }else
        {
            Print("I can't find the next question list.");
        }
    }
    SnapmanCleanUp();
}

E. Submitting Questionnaire Button Event, Event Code:

//I. Line Number of Task for Getting Date and Name
int GetProblemRow(void *g,int index)
{
    wchar_t *n = NULL;
    int maxrow = SnapmanGridGetTotalDataRow(g);
    if(index > 0)
    {
        for(int row = maxrow;row >= 4; row--)
        {
            if(SnapmanCellGetInt(g,row,1)==index)
            {
                return row;    
            }
        }
    }
    return maxrow + 1;
}
void SetProblemInfo(void *g,void *gProblem,int row)
{    
    SnapmanCellSetInt(gProblem,row,1,row - 3);
    SnapmanCellSetText(gProblem,row,8,SnapmanCellGetText(g,6,10));
    SnapmanCellSetText(gProblem,row,13,SnapmanCellGetText(g,7,3));
    SnapmanCellSetText(gProblem,row,9,SnapmanCellGetText(g,7,10));
    SnapmanCellSetText(gProblem,row,2,SnapmanCellGetText(g,8,3));
    SnapmanCellSetText(gProblem,row,3,SnapmanCellGetText(g,10,3));
    SnapmanCellSetPicture(gProblem,row,4,SnapmanCellGetPicture(g,23,3));
    SnapmanCellSetFile(gProblem,row,5,SnapmanCellGetFile(g,23,10));
    SnapmanCellSetText(gProblem,row,6,DateTime());
    SnapmanCellSetText(gProblem,row,7,SnapmanGetUserName());
    SnapmanGridSave(gProblem);
    //Clean up the questionnaire
    SnapmanCellClearData(g,6,3);
    SnapmanCellClearData(g,6,10);
    SnapmanCellClearData(g,7,3);
    SnapmanCellClearData(g,7,10);
    SnapmanCellClearData(g,8,3);
    SnapmanCellClearData(g,10,3);
    SnapmanCellClearData(g,23,3);
    SnapmanCellClearData(g,23,10);
    
}
//6. Button Event Function
void OnButtonClick(void *g, int row, int col)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gProblem   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    int row = 0, rego = 1;
    if(gProject&&gProblem)
    {
        wchar_t *text1 = SnapmanCellGetText(g,6,10);
        wchar_t *text2 = SnapmanCellGetText(g,7,3);
        wchar_t *text3 = SnapmanCellGetText(g,7,10);
        wchar_t *text4 = SnapmanCellGetText(g,8,3);
        wchar_t *text5 = SnapmanCellGetText(g,10,3);
        if(!text1||text1[0]==0)
        {
            rego = 0;
            Print("Please select the question level!");    
        }else if(!text2||text2[0]==0)
        {
            rego = 0;
            Print("Please select the developer!");    
        }else if(!text3||text3[0]==0)
        {
            rego = 0;
            Print("Please select the question status!");    
        }else if(!text4||text4[0]==0)
        {
            rego = 0;
            Print("Please fill in the relevant questions. Story!");    
        }else if(!text5||text5[0]==0)
        {
            rego = 0;
            Print("Please fill in the question description!");    
        }
        if(rego)
        {
            row = GetProblemRow(gProblem,SnapmanCellGetInt(g,6,3));
            SetProblemInfo(g,gProblem,row);
            Print("Questionnaire has been submitted successfully!");
        }
    }
    SnapmanCleanUp();
}

F. When the final code is written, set the table to a non-saveable state, so that the table can only be used for work and not for data storage, so that the questionnaires written by each person will not affect each other.

        

 

Thirdly, it is the work part of the supervisor. Create three tables as follows: Flower Season Daily Audit, Flower Season Team Evaluation and Flower Season Project Progress. These tables involve interface design and code control, which takes more than 20 minutes, and code control takes less than an hour for each table.

01. Flower Season Daily audit, this table includes: project information, employee list, current employee selection daily, supervisor's assessment information (daily assessment scores are included in the final assessment results). Incidents include:

A. Initialization of events, automatic acquisition of project information, employee list, current selection of employees'daily reports, evaluation information, event code:

wchar_t* GetEmployee(void *g,void *m,wchar_t *date,wchar_t *name)
{
    int row = 4;
    wchar_t *d,*n,*result = NULL,*manager;
    while(1)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(!d||!n)break;
        if(wcsicmp(date,d)==0)
        {
            manager = FindMap(m,n);
            if(manager&&wcsicmp(manager,name)==0)
            {
                if(!result)
                {
                    result = n;
                }else
                {
                    result = concat3(result,L"\n",n);
                }
            }
        }
        row++;
    }
    return result;
}
void * GetUserManager(void *g)
{
    int row = 18;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *strName = NULL, *strManager = NULL;
    void *result = NULL;
    for(; row <= maxRow; row++)
    {
        strName = SnapmanCellGetText(g,row,2);
        strManager = SnapmanCellGetText(g,row,13);
        if(strName && strManager)
        {
            result = InsertMap(result,strName,strManager);
        }
    }
    return result;
}

int GetDailyRow(void *g,wchar_t *user,wchar_t *time)
{
    int row = 4;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(!d||!n)break;
        if(wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row;
        row++;
    }
    return 0;
}

void OnInitialize(void *g)
{
    int row = 0;
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gDaily   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    if(gProject&&gDaily)
    {
        SnapmanCellSetLock(g,4,3,0);
        SnapmanCellSetLock(g,4,10,0);
        SnapmanCellSetLock(g,5,10,0);            
        SnapmanCellSetText(g,4,3,Date());
        SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3));
        SnapmanCellSetCombo(g,5,3,GetEmployee(gDaily,GetUserManager(gProject),Date(),SnapmanGetUserName()));
        SnapmanCellSetText(g,5,10,SnapmanGetUserName());
        SnapmanCellSetLock(g,4,3,1);
        SnapmanCellSetLock(g,4,10,1);
        SnapmanCellSetLock(g,5,10,1);
        
        SnapmanCellSetComboIndex(g,5,3,0);
        row = GetDailyRow(gDaily,SnapmanCellGetText(g,5,3),Date());
        if(row > 0)
        {
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4));
            SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6));
            SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7));
            SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10));
            SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9));
            
            SnapmanCellSetText(g,28,3,SnapmanCellGetText(gDaily,row,11));
            SnapmanCellSetText(g,36,3,SnapmanCellGetText(gDaily,row,12));
        }else
        {
            Print("There is no user daily.");
        }
        
    }
    SnapmanCleanUp();
}

B. Selection events of employee selection drop-down boxes to obtain daily reports, evaluation information and event codes of current employee selection:

int GetDailyRow(void *g,wchar_t *user,wchar_t *time)
{
    int row = 4;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(!d||!n)break;
        if(wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row;
        row++;
    }
    return 0;
}

void OnComboChanged(void *g, int row, int col,wchar_t *text)
{
    
    int row = 0;
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gDaily   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    if(gProject&&gDaily)
    {
        row = GetDailyRow(gDaily,text,Date());
        if(row > 0)
        {
            SnapmanCellSetText(g,6,3,SnapmanCellGetText(gDaily,row,4));
            SnapmanCellSetProgress(g,6,10,SnapmanCellGetInt(gDaily,row,5));
            SnapmanCellSetText(g,7,3,SnapmanCellGetText(gDaily,row,6));
            SnapmanCellSetText(g,14,3,SnapmanCellGetText(gDaily,row,7));
            SnapmanCellSetFile(g,21,10,SnapmanCellGetFile(gDaily,row,10));
            SnapmanCellSetPicture(g,21,3,SnapmanCellGetPicture(gDaily,row,9));
            
            SnapmanCellSetText(g,28,3,SnapmanCellGetText(gDaily,row,11));
            SnapmanCellSetText(g,36,3,SnapmanCellGetText(gDaily,row,12));
        }else
        {
            Print("User Daily could not be found.");
        }
        
    }
    SnapmanCleanUp();
}

C. Submit Daily Review Button Event, Event Code:

int GetDailyRow(void *g,wchar_t *user,wchar_t *time)
{
    int row = 4;
    wchar_t *d,*n;
    while(1)
    {
        d = SnapmanCellGetText(g,row,2);
        n = SnapmanCellGetText(g,row,3);
        if(!d||!n)break;
        if(wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row;
        row++;
    }
    return 0;
}

void OnButtonClick(void *g, int row, int col)
{
    if(!SnapmanCellIsEmpty(g,28,3))
    {
        void *gDaily   = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
        int row = GetDailyRow(gDaily,SnapmanCellGetText(g,5,3),Date());
        SnapmanCellSetText(gDaily,row,11,SnapmanCellGetText(g,28,3));
        SnapmanCellSetText(gDaily,row,12,SnapmanCellGetText(g,36,3));
        SnapmanCellSetText(gDaily,row,13,DateTime());
        SnapmanCellSetText(gDaily,row,14,SnapmanGetUserName());
        SnapmanGridSave(gDaily);
        Print("Successful submission of daily evaluation!");
    }else
    {
        Print("Please fill in the supervisor's evaluation.");
    }
    SnapmanCleanUp();
}

D. After the final code is written, set the form to a non-saveable state, so that the form can only be used for work and not for data storage, so that everybody's daily audit will not have an impact on each other.

        

 

02. Flower Season Team Evaluation. This table includes project information, employees'work points today, completion schedule, summary today, tomorrow plan, work-related pictures and attachments. Incidents include:

A. Initialization of events, automatic acquisition of project information, employee list, automatic calculation and selection of employee's work completion status, daily evaluation information, job score and job rating, access to supervisor evaluation information, event code:

wchar_t* GetEmployee(void *m,wchar_t *name)
{
    Pair *p = ForeachMap(m);
    wchar_t *result = NULL;
    while(p)
    {
        if(wcsicmp(name,(wchar_t*)p->value)==0)
        {
            if(!result)
            {
                result = (wchar_t*)p->key;
            }else
            {
                result = concat3(result,L"\n",(wchar_t*)p->key);
            }
        }
        p = ForeachMap(m);
    }
    return result;
}

void * GetUserManager(void *g)
{
    int row = 18;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *strName = NULL, *strManager = NULL;
    void *result = NULL;
    for(; row <= maxRow; row++)
    {
        strName = SnapmanCellGetText(g,row,2);
        strManager = SnapmanCellGetText(g,row,13);
        if(strName && strManager)
        {
            result = InsertMap(result,strName,strManager);
        }
    }
    return result;
}

int GetEvaluationRow(void *g,wchar_t *user,wchar_t *time)
{
    int row = 4;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *d,*n;
    for(; row <= maxRow; row++)
    {
        d = SnapmanCellGetText(g,row,3);
        n = SnapmanCellGetText(g,row,2);
        if(d&&n&&wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row;
    }
    return 0;
}
wchar_t *GetEvaluationLevel(int score)
{
    wchar_t *result = L("A");
    if(score>=90)
    {
        result[0] = 'S';
    }else if(score>=80)
    {
        result[0] = 'A';
    }else if(score>=70)
    {
        result[0] = 'B';
    }else if(score>=60)
    {
        result[0] = 'C';
    }else
    {
        result[0] = 'D';
    }
    return result;
}

int GetProblemPoint(wchar_t *level)
{
    if(wcsicmp(level,L("deadly"))==0)
    {
        return 10;
    }else if(wcsicmp(level,L("serious"))==0)
    {
        return 6;
    }else if(wcsicmp(level,L("commonly"))==0)
    {
        return 2;
    }else if(wcsicmp(level,L("Tips"))==0)
    {
        return 1;
    }else
    {
        return 0;
    }
}

void CalcEmployeeScope(void *g,void* gEvaluation,wchar_t *user)
{
    void *gPlan     = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    void *gProblem  = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    void *gDaily    = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    int row  = 17, totalPoint = 0, pTotalPoint = 0,dTotalPoint = 0, nTaskCount = 0 , nFinish = 0, nScore = 0;
    int erow = SnapmanGridGetTotalDataRow(gPlan);
    int uFinishPoint = 0, uUnfinishRation = 0, uProblemPoint = 0, uProblemCount = 0;
    int uDailyPoinnt = 0, uDailyRatio = 15;
    int uManagerScore = 0, uManagerRatio = 15;
    int uWorkingScore = 0, uFinalScore = 0;
    //1,Schedule of Work in the First Operating Plan
    for(; row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gPlan,row,12))==0)//Find the corresponding tasks for employees
        {
            if(wcsicmp(Date(),SnapmanCellGetText(gPlan,row,6)) >= 0)//Calculate only expired tasks
            {
                uFinishPoint += SnapmanCellGetInt(gPlan,row,5) * SnapmanCellGetInt(gPlan,row,7) / 100;//Points of Accumulated Completion
                totalPoint += SnapmanCellGetInt(gPlan,row,5);//Accumulation of points
                nFinish    += SnapmanCellGetInt(gPlan,row,7);//Progress accumulation
                nTaskCount++;//Cumulative number
            }
        }
    }
    if(nTaskCount)
    {
        uUnfinishRation = nFinish/nTaskCount-100;
    }
    SnapmanCellSetInt(g,6,3,uFinishPoint);                            //Setting the number of completion points
    SnapmanCellSetText(g,6,10,concat2(itostr(uUnfinishRation),L"%")); //Setting schedule deviation
    
    //2,Question sheet evaluation
    nTaskCount = 0;
    for(row = 4,erow = SnapmanGridGetTotalDataRow(gProblem); row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gProblem,row,13))==0)//Find the corresponding tasks for employees
        {
            pTotalPoint += GetProblemPoint(SnapmanCellGetText(gProblem,row,8));//Accumulation of points
            nTaskCount++;//Cumulative number
        }
    }
    SnapmanCellSetInt(g,7,3,pTotalPoint);    //Setting the single point of the problem
    SnapmanCellSetInt(g,7,10,nTaskCount);   //Setting a single number of questions
    
    //3,Evaluation of Operational Daily
    nScore = nTaskCount = 0;
    for(row = 4,erow = SnapmanGridGetTotalDataRow(gDaily); row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gDaily,row,3))==0)//Find the corresponding tasks for employees
        {
            dTotalPoint += SnapmanCellGetInt(gDaily,row,4);//Accumulation of points
            nScore     += SnapmanCellGetInt(gDaily,row,4) * SnapmanCellGetInt(gDaily,row,12);//Accumulation of test scores
            nTaskCount++;//Cumulative number
        }
    }
    if(nTaskCount)
    {
        uDailyPoinnt = nScore / dTotalPoint;
        uDailyRatio  = SnapmanCellGetInt(g,8,10);
    }
    SnapmanCellSetInt(g,8,3,uDailyPoinnt);                            //Setting Daily Examination Scores
    
    //4,Operational Work Score and Work Level
    uManagerScore = SnapmanCellGetInt(g,23,3);
    uManagerRatio = SnapmanCellGetInt(g,23,10);
    
    uWorkingScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100;
    uFinalScore   = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio - uManagerRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100 + uManagerScore * uManagerRatio/100;
    
    SnapmanCellSetInt(g,9,3,uWorkingScore);                            //Setting Job Score
    SnapmanCellSetText(g,9,10,GetEvaluationLevel(uWorkingScore));      //Setting up job test ratings
    SnapmanCellSetInt(g,25,3,uFinalScore);                             //Set the final score
    SnapmanCellSetText(g,25,10,GetEvaluationLevel(uFinalScore));       //Set up final test ratings
    
}

void SetEmployeeChange(void *g,void *gEvaluation,wchar_t *user)
{
    if(user==NULL||wcslen(user)==0)return;
    int row = GetEvaluationRow(gEvaluation,user,Date());
    if(row > 0)
    {
        SnapmanCellSetText(g,6,3,SnapmanCellGetText(gEvaluation,row,4));//Number of Completion Points
        SnapmanCellSetText(g,6,10,SnapmanCellGetText(gEvaluation,row,5));//Schedule deviation
        SnapmanCellSetText(g,7,3,SnapmanCellGetText(gEvaluation,row,6));//Single Point of Problem
        SnapmanCellSetText(g,7,10,SnapmanCellGetText(gEvaluation,row,7));//Total number of problem lists
        SnapmanCellSetText(g,8,3,SnapmanCellGetText(gEvaluation,row,8));//Daily total score
        SnapmanCellSetText(g,9,3,SnapmanCellGetText(gEvaluation,row,9));//Work score
        SnapmanCellSetText(g,10,3,SnapmanCellGetText(gEvaluation,row,10));//Supervisor's comments
        SnapmanCellSetText(g,23,3,SnapmanCellGetText(gEvaluation,row,11));//Supervisor score
        SnapmanCellSetText(g,25,3,SnapmanCellGetText(gEvaluation,row,13));//Final score
        SnapmanCellSetText(g,25,10,SnapmanCellGetText(gEvaluation,row,14));//Evaluation level    
        SnapmanCellSetText(g,9,10,GetEvaluationLevel(SnapmanCellGetInt(gEvaluation,row,9)));//Grading of Job Examination
    }else
    {
        CalcEmployeeScope(g,gEvaluation,user);
    }
}
void OnInitialize(void *g)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gEvaluation  = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\05.Flower Season Employee Evaluation"));
    if(gProject&&gEvaluation)
    {
        SnapmanCellSetLock(g,4,3,0);
        SnapmanCellSetLock(g,4,10,0);
        SnapmanCellSetLock(g,5,10,0);            
        SnapmanCellSetText(g,4,3,Date());
        SnapmanCellSetText(g,4,10,SnapmanCellGetText(gProject,3,3));
        SnapmanCellSetCombo(g,5,3,GetEmployee(GetUserManager(gProject),SnapmanGetUserName()));
        SnapmanCellSetText(g,5,10,SnapmanGetUserName());
        SnapmanCellSetLock(g,4,3,1);
        SnapmanCellSetLock(g,4,10,1);
        SnapmanCellSetLock(g,5,10,1);
        
        SnapmanCellSetComboIndex(g,5,3,0);
        SetEmployeeChange(g,gEvaluation,SnapmanCellGetText(g,5,3));
        
    }
    SnapmanCleanUp();
}

B. Selection events of employee selection drop-down boxes to obtain the current job completion status, daily evaluation information, job scores and job ratings, supervisor evaluation information, event code:

wchar_t* GetEmployee(void *m,wchar_t *name)
{
    Pair *p = ForeachMap(m);
    wchar_t *result = NULL;
    while(p)
    {
        if(wcsicmp(name,(wchar_t*)p->value)==0)
        {
            if(!result)
            {
                result = (wchar_t*)p->key;
            }else
            {
                result = concat3(result,L"\n",(wchar_t*)p->key);
            }
        }
        p = ForeachMap(m);
    }
    return result;
}

void * GetUserManager(void *g)
{
    int row = 18;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *strName = NULL, *strManager = NULL;
    void *result = NULL;
    for(; row <= maxRow; row++)
    {
        strName = SnapmanCellGetText(g,row,2);
        strManager = SnapmanCellGetText(g,row,13);
        if(strName && strManager)
        {
            result = InsertMap(result,strName,strManager);
        }
    }
    return result;
}

int GetEvaluationRow(void *g,wchar_t *user,wchar_t *time)
{
    int row = 4;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *d,*n;
    for(; row <= maxRow; row++)
    {
        d = SnapmanCellGetText(g,row,3);
        n = SnapmanCellGetText(g,row,2);
        if(d&&n&&wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row;
    }
    return 0;
}
wchar_t *GetEvaluationLevel(int score)
{
    wchar_t *result = L("A");
    if(score>=90)
    {
        result[0] = 'S';
    }else if(score>=80)
    {
        result[0] = 'A';
    }else if(score>=70)
    {
        result[0] = 'B';
    }else if(score>=60)
    {
        result[0] = 'C';
    }else
    {
        result[0] = 'D';
    }
    return result;
}

int GetProblemPoint(wchar_t *level)
{
    if(wcsicmp(level,L("deadly"))==0)
    {
        return 10;
    }else if(wcsicmp(level,L("serious"))==0)
    {
        return 6;
    }else if(wcsicmp(level,L("commonly"))==0)
    {
        return 2;
    }else if(wcsicmp(level,L("Tips"))==0)
    {
        return 1;
    }else
    {
        return 0;
    }
}

void CalcEmployeeScope(void *g,void* gEvaluation,wchar_t *user)
{
    void *gPlan     = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    void *gProblem  = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    void *gDaily    = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    int row  = 17, totalPoint = 0, pTotalPoint = 0,dTotalPoint = 0, nTaskCount = 0 , nFinish = 0, nScore = 0;
    int erow = SnapmanGridGetTotalDataRow(gPlan);
    int uFinishPoint = 0, uUnfinishRation = 0, uProblemPoint = 0, uProblemCount = 0;
    int uDailyPoinnt = 0, uDailyRatio = 15;
    int uManagerScore = 0, uManagerRatio = 15;
    int uWorkingScore = 0, uFinalScore = 0;
    //1,Schedule of Work in the First Operating Plan
    for(; row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gPlan,row,12))==0)//Find the corresponding tasks for employees
        {
            if(wcsicmp(Date(),SnapmanCellGetText(gPlan,row,6)) >= 0)//Calculate only expired tasks
            {
                uFinishPoint += SnapmanCellGetInt(gPlan,row,5) * SnapmanCellGetInt(gPlan,row,7) / 100;//Points of Accumulated Completion
                totalPoint += SnapmanCellGetInt(gPlan,row,5);//Accumulation of points
                nFinish    += SnapmanCellGetInt(gPlan,row,7);//Progress accumulation
                nTaskCount++;//Cumulative number
            }
        }
    }
    if(nTaskCount)
    {
        uUnfinishRation = nFinish/nTaskCount-100;
    }
    SnapmanCellSetInt(g,6,3,uFinishPoint);                            //Setting the number of completion points
    SnapmanCellSetText(g,6,10,concat2(itostr(uUnfinishRation),L"%")); //Setting schedule deviation
    
    //2,Question sheet evaluation
    nTaskCount = 0;
    for(row = 4,erow = SnapmanGridGetTotalDataRow(gProblem); row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gProblem,row,13))==0)//Find the corresponding tasks for employees
        {
            pTotalPoint += GetProblemPoint(SnapmanCellGetText(gProblem,row,8));//Accumulation of points
            nTaskCount++;//Cumulative number
        }
    }
    SnapmanCellSetInt(g,7,3,pTotalPoint);    //Setting the single point of the problem
    SnapmanCellSetInt(g,7,10,nTaskCount);   //Setting a single number of questions
    
    //3,Evaluation of Operational Daily
    nScore = nTaskCount = 0;
    for(row = 4,erow = SnapmanGridGetTotalDataRow(gDaily); row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gDaily,row,3))==0)//Find the corresponding tasks for employees
        {
            dTotalPoint += SnapmanCellGetInt(gDaily,row,4);//Accumulation of points
            nScore     += SnapmanCellGetInt(gDaily,row,4) * SnapmanCellGetInt(gDaily,row,12);//Accumulation of test scores
            nTaskCount++;//Cumulative number
        }
    }
    if(nTaskCount)
    {
        uDailyPoinnt = nScore / dTotalPoint;
        uDailyRatio  = SnapmanCellGetInt(g,8,10);
    }
    SnapmanCellSetInt(g,8,3,uDailyPoinnt);                            //Setting Daily Examination Scores
    
    //4,Operational Work Score and Work Level
    uManagerScore = SnapmanCellGetInt(g,23,3);
    uManagerRatio = SnapmanCellGetInt(g,23,10);
    Print("%d",uDailyPoinnt * uDailyRatio / 100);
    uWorkingScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100;
    uFinalScore   = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio - uManagerRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100 + uManagerScore * uManagerRatio/100;
    
    SnapmanCellSetInt(g,9,3,uWorkingScore);                            //Setting Job Score
    SnapmanCellSetText(g,9,10,GetEvaluationLevel(uWorkingScore));      //Setting up job test ratings
    SnapmanCellSetInt(g,25,3,uFinalScore);                             //Set the final score
    SnapmanCellSetText(g,25,10,GetEvaluationLevel(uFinalScore));       //Set up final test ratings
    
}

void SetEmployeeChange(void *g,void *gEvaluation,wchar_t *user)
{
    if(user==NULL||wcslen(user)==0)return;
    int row = GetEvaluationRow(gEvaluation,user,Date());
    if(row > 0)
    {
        SnapmanCellSetText(g,6,3,SnapmanCellGetText(gEvaluation,row,4));//Number of Completion Points
        SnapmanCellSetText(g,6,10,SnapmanCellGetText(gEvaluation,row,5));//Schedule deviation
        SnapmanCellSetText(g,7,3,SnapmanCellGetText(gEvaluation,row,6));//Single Point of Problem
        SnapmanCellSetText(g,7,10,SnapmanCellGetText(gEvaluation,row,7));//Total number of problem lists
        SnapmanCellSetText(g,8,3,SnapmanCellGetText(gEvaluation,row,8));//Daily total score
        SnapmanCellSetText(g,9,3,SnapmanCellGetText(gEvaluation,row,9));//Work score
        SnapmanCellSetText(g,10,3,SnapmanCellGetText(gEvaluation,row,10));//Supervisor's comments
        SnapmanCellSetText(g,23,3,SnapmanCellGetText(gEvaluation,row,11));//Supervisor score
        SnapmanCellSetText(g,25,3,SnapmanCellGetText(gEvaluation,row,13));//Final score
        SnapmanCellSetText(g,25,10,SnapmanCellGetText(gEvaluation,row,14));//Evaluation level    
        SnapmanCellSetText(g,9,10,GetEvaluationLevel(SnapmanCellGetInt(gEvaluation,row,9)));//Grading of Job Examination
    }else
    {
        CalcEmployeeScope(g,gEvaluation,user);
    }
}
void OnComboChanged(void *g, int row, int col,wchar_t *text)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
    void *gEvaluation  = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\05.Flower Season Employee Evaluation"));
    if(gProject&&gEvaluation)
    {
        SetEmployeeChange(g,gEvaluation,text);
    }
    SnapmanCleanUp();
}

C. Submit the event of employee evaluation button, and finally calculate the employee evaluation grade, event code:

wchar_t* GetEmployee(void *m,wchar_t *name)
{
    Pair *p = ForeachMap(m);
    wchar_t *result = NULL;
    while(p)
    {
        if(wcsicmp(name,(wchar_t*)p->value)==0)
        {
            if(!result)
            {
                result = (wchar_t*)p->key;
            }else
            {
                result = concat3(result,L"\n",(wchar_t*)p->key);
            }
        }
        p = ForeachMap(m);
    }
    return result;
}

void * GetUserManager(void *g)
{
    int row = 18;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *strName = NULL, *strManager = NULL;
    void *result = NULL;
    for(; row <= maxRow; row++)
    {
        strName = SnapmanCellGetText(g,row,2);
        strManager = SnapmanCellGetText(g,row,13);
        if(strName && strManager)
        {
            result = InsertMap(result,strName,strManager);
        }
    }
    return result;
}

int GetEvaluationRow(void *g,wchar_t *user,wchar_t *time)
{
    int row = 4;
    int maxRow = SnapmanGridGetTotalDataRow(g);
    wchar_t *d,*n;
    for(; row <= maxRow; row++)
    {
        d = SnapmanCellGetText(g,row,3);
        n = SnapmanCellGetText(g,row,2);
        if(d&&n&&wcsicmp(time,d)==0&&wcsicmp(n,user)==0)return row;
    }
    return 0;
}
wchar_t *GetEvaluationLevel(int score)
{
    wchar_t *result = L("A");
    if(score>=90)
    {
        result[0] = 'S';
    }else if(score>=80)
    {
        result[0] = 'A';
    }else if(score>=70)
    {
        result[0] = 'B';
    }else if(score>=60)
    {
        result[0] = 'C';
    }else
    {
        result[0] = 'D';
    }
    return result;
}

int GetProblemPoint(wchar_t *level)
{
    if(wcsicmp(level,L("deadly"))==0)
    {
        return 10;
    }else if(wcsicmp(level,L("serious"))==0)
    {
        return 6;
    }else if(wcsicmp(level,L("commonly"))==0)
    {
        return 2;
    }else if(wcsicmp(level,L("Tips"))==0)
    {
        return 1;
    }else
    {
        return 0;
    }
}

void CalcEmployeeScope(void *g,void* gEvaluation,wchar_t *user)
{
    void *gPlan     = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    void *gProblem  = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\04.Flower Season Problem Tracking"));
    void *gDaily    = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\03.Flower Season Work Daily"));
    int row  = 17, totalPoint = 0, pTotalPoint = 0,dTotalPoint = 0, nTaskCount = 0 , nFinish = 0, nScore = 0;
    int erow = SnapmanGridGetTotalDataRow(gPlan);
    int uFinishPoint = 0, uUnfinishRation = 0, uProblemPoint = 0, uProblemCount = 0;
    int uDailyPoinnt = 0, uDailyRatio = 15;
    int uManagerScore = 0, uManagerRatio = 15;
    int uWorkingScore = 0, uFinalScore = 0;
    //1,Schedule of Work in the First Operating Plan
    for(; row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gPlan,row,12))==0)//Find the corresponding tasks for employees
        {
            if(wcsicmp(Date(),SnapmanCellGetText(gPlan,row,6)) >= 0)//Calculate only expired tasks
            {
                uFinishPoint += SnapmanCellGetInt(gPlan,row,5) * SnapmanCellGetInt(gPlan,row,7) / 100;//Points of Accumulated Completion
                totalPoint += SnapmanCellGetInt(gPlan,row,5);//Accumulation of points
                nFinish    += SnapmanCellGetInt(gPlan,row,7);//Progress accumulation
                nTaskCount++;//Cumulative number
            }
        }
    }
    if(nTaskCount)
    {
        uUnfinishRation = nFinish/nTaskCount-100;
    }
    SnapmanCellSetInt(g,6,3,uFinishPoint);                            //Setting the number of completion points
    SnapmanCellSetText(g,6,10,concat2(itostr(uUnfinishRation),L"%")); //Setting schedule deviation
    
    //2,Question sheet evaluation
    nTaskCount = 0;
    for(row = 4,erow = SnapmanGridGetTotalDataRow(gProblem); row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gProblem,row,13))==0)//Find the corresponding tasks for employees
        {
            pTotalPoint += GetProblemPoint(SnapmanCellGetText(gProblem,row,8));//Accumulation of points
            nTaskCount++;//Cumulative number
        }
    }
    SnapmanCellSetInt(g,7,3,pTotalPoint);    //Setting the single point of the problem
    SnapmanCellSetInt(g,7,10,nTaskCount);   //Setting a single number of questions
    
    //3,Evaluation of Operational Daily
    nScore = nTaskCount = 0;
    for(row = 4,erow = SnapmanGridGetTotalDataRow(gDaily); row <= erow; row++)
    {
        if(wcsicmp(user,SnapmanCellGetText(gDaily,row,3))==0)//Find the corresponding tasks for employees
        {
            dTotalPoint += SnapmanCellGetInt(gDaily,row,4);//Accumulation of points
            nScore     += SnapmanCellGetInt(gDaily,row,4) * SnapmanCellGetInt(gDaily,row,12);//Accumulation of test scores
            nTaskCount++;//Cumulative number
        }
    }
    if(nTaskCount)
    {
        uDailyPoinnt = nScore / dTotalPoint;
        uDailyRatio  = SnapmanCellGetInt(g,8,10);
    }
    SnapmanCellSetInt(g,8,3,uDailyPoinnt);                            //Setting Daily Examination Scores
    
    //4,Operational Work Score and Work Level
    uManagerScore = SnapmanCellGetInt(g,23,3);
    uManagerRatio = SnapmanCellGetInt(g,23,10);
    
    uWorkingScore = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100;
    uFinalScore   = (uFinishPoint - totalPoint + uFinishPoint - pTotalPoint) * (100 - uDailyRatio - uManagerRatio) / totalPoint + uDailyPoinnt * uDailyRatio / 100 + uManagerScore * uManagerRatio/100;
    
    SnapmanCellSetInt(g,9,3,uWorkingScore);                            //Setting Job Score
    SnapmanCellSetText(g,9,10,GetEvaluationLevel(uWorkingScore));      //Setting up job test ratings
    SnapmanCellSetInt(g,25,3,uFinalScore);                             //Set the final score
    SnapmanCellSetText(g,25,10,GetEvaluationLevel(uFinalScore));       //Set up final test ratings
    
}

int SetEmployeeChange(void *g,void *gEvaluation,wchar_t *user)
{
    if(user==NULL||wcslen(user)==0)return 0;
    int row = GetEvaluationRow(gEvaluation,user,Date());
    if(row > 0)
    {
        SnapmanCellSetText(g,6,3,SnapmanCellGetText(gEvaluation,row,4));//Number of Completion Points
        SnapmanCellSetText(g,6,10,SnapmanCellGetText(gEvaluation,row,5));//Schedule deviation
        SnapmanCellSetText(g,7,3,SnapmanCellGetText(gEvaluation,row,6));//Single Point of Problem
        SnapmanCellSetText(g,7,10,SnapmanCellGetText(gEvaluation,row,7));//Total number of problem lists
        SnapmanCellSetText(g,8,3,SnapmanCellGetText(gEvaluation,row,8));//Daily total score
        SnapmanCellSetText(g,9,3,SnapmanCellGetText(gEvaluation,row,9));//Work score
        SnapmanCellSetText(g,10,3,SnapmanCellGetText(gEvaluation,row,10));//Supervisor's comments
        SnapmanCellSetText(g,23,3,SnapmanCellGetText(gEvaluation,row,11));//Supervisor score
        SnapmanCellSetText(g,25,3,SnapmanCellGetText(gEvaluation,row,13));//Final score
        SnapmanCellSetText(g,25,10,SnapmanCellGetText(gEvaluation,row,14));//Evaluation level    
        SnapmanCellSetText(g,9,10,GetEvaluationLevel(SnapmanCellGetInt(gEvaluation,row,9)));//Grading of Job Examination
    }
    CalcEmployeeScope(g,gEvaluation,user);
    return row;
}

void SaveEvaluation(void *g,void *gEvaluation,int row)
{
    if(row==0)row = SnapmanGridGetTotalDataRow(gEvaluation) + 1;
    SnapmanCellSetInt(gEvaluation,row,1,row-3);                        //Set ordinal number
    SnapmanCellSetText(gEvaluation,row,2,SnapmanCellGetText(g,5,3));   //Setting up evaluation staff
    SnapmanCellSetText(gEvaluation,row,3,Date());                      //Setting up evaluation time
    SnapmanCellSetText(gEvaluation,row,4,SnapmanCellGetText(g,6,3));   //Number of Completion Points
    SnapmanCellSetText(gEvaluation,row,5,SnapmanCellGetText(g,6,10));  //Schedule deviation
    SnapmanCellSetText(gEvaluation,row,6,SnapmanCellGetText(g,7,3));   //Single Point of Problem
    SnapmanCellSetText(gEvaluation,row,7,SnapmanCellGetText(g,7,10));  //Total number of problem lists
    SnapmanCellSetText(gEvaluation,row,8,SnapmanCellGetText(g,8,3));   //Daily total score
    SnapmanCellSetText(gEvaluation,row,9,SnapmanCellGetText(g,9,3));   //Work score
    SnapmanCellSetText(gEvaluation,row,10,SnapmanCellGetText(g,10,3)); //Supervisor's comments
    SnapmanCellSetText(gEvaluation,row,11,SnapmanCellGetText(g,23,3)); //Supervisor score
    SnapmanCellSetText(gEvaluation,row,12,SnapmanGetUserName());       //Setup Supervisor
    SnapmanCellSetText(gEvaluation,row,13,SnapmanCellGetText(g,25,3)); //Final score
    SnapmanCellSetText(gEvaluation,row,14,SnapmanCellGetText(g,25,10));//Evaluation level    
    SnapmanGridSave(gEvaluation);
    Print("Successful submission of employee evaluation.");
}

void OnButtonClick(void *g, int row, int col)
{
    if(SnapmanCellIsEmpty(g,10,3))
    {
        Print("Please fill in the supervisor's comments.");
        return;
    }else if(SnapmanCellIsEmpty(g,23,3))
    {
        Print("Please fill in the supervisor's score.");
        return;
    }else
    {
        void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\01.Flower Season Project Information"));
        void *gEvaluation  = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\05.Flower Season Employee Evaluation"));
        if(gProject&&gEvaluation)
        {
            SaveEvaluation(g,gEvaluation,SetEmployeeChange(g,gEvaluation,SnapmanCellGetText(g,5,3)));
        }
        SnapmanCleanUp();
    }
}

D. After the final code is written, set the form to a non-saveable state, so that the form can only be used for work and not for data storage, so that the employee reviews written by each person will not affect each other.

        

 

03. Flower Season Project Progress. This table includes design, development, testing, release progress, overall project progress and expected project completion time. Incidents include:

A. Initialize events, automatically get progress in computing design, development, testing, release, overall project progress and expected project completion time, event code:

void SetProjectInfo(void *g,void *gProject)
{
    wchar_t *strProgress = NULL, *strDiff = NULL, *strStep = NULL;
    wchar_t *strStep1 = L("Design");
    wchar_t *strStep2 = L("Development");
    wchar_t *strStep3 = L("test");
    wchar_t *strStep4 = L("Version release");
    wchar_t *strStarTime = SnapmanCellGetText(gProject,4,3);
    char buffer[1024] = {0};
    int index = 0;
    double nd[4] = {0};//Total progress
    double id[4] = {0};//Number up to today
    double td[4] = {0};//Total number
    double nto = 0,ito = 0,tto = 0;
    int srow = 4;
    for(int row = SnapmanGridGetTotalDataRow(gProject); row >= 17; row--)
    {
        strStep = SnapmanCellGetText(gProject,row,2);
        if(wcsicmp(strStep,strStep1)==0)
        {
            index = 0;
        }else if(wcsicmp(strStep,strStep2)==0)
        {
            index = 1;
        }else if(wcsicmp(strStep,strStep3)==0)
        {
            index = 2;
        }else 
        {
            index = 3;
        }
        
        if(wcsicmp(Date(),SnapmanCellGetText(gProject,row,6)) >= 0)
        {
            tto++;
            td[index]++;
        }
        nd[index] += SnapmanCellGetInt(gProject,row,7);
        nto += SnapmanCellGetInt(gProject,row,7);
        id[index]++;
        ito++;
    }
    for(int i = 0; i < 4; i++)
    {
        if(id[i]==0)
        {
            SnapmanCellSetText(g,srow,5,L" -");
        }else
        {
            sprintf(buffer," %.1f",nd[i]/id[i]);
            SnapmanCellSetText(g,srow,5,concat2(L(buffer),L"%"));
        }
        if(td[i]==0)
        {
            SnapmanCellSetText(g,srow+1,5,L" -");
        }else
        {
            sprintf(buffer," %.1f",(nd[i]-td[i]*100)/td[i]);
            SnapmanCellSetText(g,srow+1,5,concat2(L(buffer),L"%"));
        }
        srow += 2;
    }
    if(ito==0)
    {
        SnapmanCellSetText(g,12,4,L" -");
    }else
    {
        sprintf(buffer,"%.1f",nto/ito);
        SnapmanCellSetText(g,12,4,concat2(L(buffer),L"%"));
    }
    if(tto==0)
    {
        SnapmanCellSetText(g,12,11,L" -");
    }else
    {
        sprintf(buffer," %.1f",(nto-tto*100)/tto);
        SnapmanCellSetText(g,12,11,concat2(L(buffer),L"%"));
    }
    SnapmanCellSetText(g,16,4,SnapmanCellGetText(gProject,8,3));
    
    if(strStarTime==NULL||wcslen(strStarTime)==0)
    {
        SnapmanCellSetText(g,16,11,L" -");
    }else
    {
        int n = DiffDay(Date(),strStarTime);
        int d = ito==0?0:(int)((1-nto/ito/100) * n);
        if(d < 0)d = 0;
        SnapmanCellSetText(g,16,11,AddDay(SnapmanCellGetText(gProject,8,3),d));
    }
}

void OnInitialize(void *g)
{
    void *gProject = SnapmanGetGrid(L("\\Flower Season Project Management System\\Data\\02.Flower Planning Information"));
    if(gProject)
    {
        SetProjectInfo(g,gProject);
    }
}

        

 

4. Conclusion: A relatively complete project management system has been developed. It took less than two days for business design and a little more than one day for event code development. Although 70% of the code is duplicated without affecting execution performance, Snapman reduced the system development work to business design work, which directly exceeded the development workload.

Download address of Snapmanb version: http://www.snapman.xyz

Posted by pmg206 on Tue, 04 Jun 2019 12:31:24 -0700