Subversion Repositories SmartDukaan

Rev

Rev 34144 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34144 Rev 34146
Line 24... Line 24...
24
                        "             fs.code as fofo_code" +
24
                        "             fs.code as fofo_code" +
25
                        "         FROM auth.auth_user au" +
25
                        "         FROM auth.auth_user au" +
26
                        "                  JOIN cs.position p ON p.auth_user_id = au.id" +
26
                        "                  JOIN cs.position p ON p.auth_user_id = au.id" +
27
                        "                  JOIN cs.partner_position pp ON pp.position_id = p.id" +
27
                        "                  JOIN cs.partner_position pp ON pp.position_id = p.id" +
28
                        "                  JOIN fofo.fofo_store fs ON fs.id = pp.partner_id" +
28
                        "                  JOIN fofo.fofo_store fs ON fs.id = pp.partner_id" +
29
                        " JOIN fofo.monthly_target mt ON mt.fofo_id = fs.id and mt.on_date >= DATE_FORMAT(CURDATE(), '%Y-%m-01')" +
29
                        " JOIN fofo.monthly_target mt ON mt.fofo_id = fs.id and mt.on_date >= DATE_FORMAT(CURDATE(), '%Y-%m-01') and mt.purchase > 0" +
30
                        "         WHERE pp.partner_id != 0" +
30
                        "         WHERE pp.partner_id != 0" +
31
                        "           AND p.category_id = 18" +
31
                        "           AND p.category_id = 18" +
32
                        "           AND p.escalation_type = 'L1'" +
32
                        "           AND p.escalation_type = 'L1'" +
33
                        "           AND fs.active = 1" +
33
                        "           AND fs.active = 1" +
34
                        "           AND fs.internal = false" +
34
                        "           AND fs.internal = false" +
Line 42... Line 42...
42
                        "                  JOIN cs.position p ON p.auth_user_id = au.id" +
42
                        "                  JOIN cs.position p ON p.auth_user_id = au.id" +
43
                        "                  JOIN cs.partner_position pp ON pp.position_id = p.id" +
43
                        "                  JOIN cs.partner_position pp ON pp.position_id = p.id" +
44
                        "                  JOIN cs.region r ON pp.region_id = r.id" +
44
                        "                  JOIN cs.region r ON pp.region_id = r.id" +
45
                        "                  JOIN cs.partner_region pr ON pr.region_id = pp.region_id" +
45
                        "                  JOIN cs.partner_region pr ON pr.region_id = pp.region_id" +
46
                        "                  JOIN fofo.fofo_store fs ON fs.id = pr.fofo_id" +
46
                        "                  JOIN fofo.fofo_store fs ON fs.id = pr.fofo_id" +
47
                        " JOIN fofo.monthly_target mt ON mt.fofo_id = fs.id and mt.on_date >= DATE_FORMAT(CURDATE(), '%Y-%m-01')" +
47
                        " JOIN fofo.monthly_target mt ON mt.fofo_id = fs.id and mt.on_date >= DATE_FORMAT(CURDATE(), '%Y-%m-01') and mt.purchase > 0" +
48
                        "         WHERE pp.partner_id = 0" +
48
                        "         WHERE pp.partner_id = 0" +
49
                        "           AND p.category_id = 18" +
49
                        "           AND p.category_id = 18" +
50
                        "           AND fs.active = 1" +
50
                        "           AND fs.active = 1" +
51
                        "           AND fs.internal = false" +
51
                        "           AND fs.internal = false" +
52
                        "           AND p.escalation_type = 'L1'" +
52
                        "           AND p.escalation_type = 'L1'" +